How to resolve "BW-RESTJSON-400002 - Export Swagger - Failed to export Swagger due to [java.lang.ArrayIndexOutOfBoundsException: 1" when exporting the Swagger file with REST Dispatch and Reply activity

How to resolve "BW-RESTJSON-400002 - Export Swagger - Failed to export Swagger due to [java.lang.ArrayIndexOutOfBoundsException: 1" when exporting the Swagger file with REST Dispatch and Reply activity

book

Article ID: KB0077850

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for REST and JSON 2.1.0

Description

Some customers might encounter below exception when exporting the Swagger file with REST Dispatch and Reply activity.
==========
- BW-RESTJSON-400000 - Export Swagger - Start to export Swagger, the Swagger file is [C:\Users\swagger\api-docs.zip].
Trampoline error: com.tibco.plugin.json.rest.swagger.ui.ExportSwaggerDialog@2b9304fd busyExportDocs
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.tibco.util.Trampoline.invoke(Trampoline.java:136)
        at com.tibco.ui.BusyWait.run(BusyWait.java:428)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generateSwaggerDoc(SwaggerGenerator.java:215)
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generateSwaggerJSONFiles(SwaggerGenerator.java:151)
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generate(SwaggerGenerator.java:83)
        at com.tibco.plugin.json.rest.swagger.ui.ExportSwaggerDialog.busyExportDocs(ExportSwaggerDialog.java:203)
        ... 7 more
- BW-RESTJSON-400002 - Export Swagger - Failed to export Swagger due to [java.lang.ArrayIndexOutOfBoundsException: 1
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generateSwaggerDoc(SwaggerGenerator.java:215)
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generateSwaggerJSONFiles(SwaggerGenerator.java:151)
        at com.tibco.plugin.json.rest.swagger.api.SwaggerGenerator.generate(SwaggerGenerator.java:83)
        at com.tibco.plugin.json.rest.swagger.ui.ExportSwaggerDialog.busyExportDocs(ExportSwaggerDialog.java:203)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.tibco.util.Trampoline.invoke(Trampoline.java:136)
        at com.tibco.ui.BusyWait.run(BusyWait.java:428)
        at java.lang.Thread.run(Thread.java:748)
==========
 

Issue/Introduction

How to resolve "BW-RESTJSON-400002 - Export Swagger - Failed to export Swagger due to [java.lang.ArrayIndexOutOfBoundsException: 1" when exporting the Swagger file with REST Dispatch and Reply activity

Environment

Operation Systems: All

Resolution

This error is because customer missed protocol when specifying the "Base URL" of "REST Dispatch and Reply" activity, for example "localhost:1234/swagger"; The correct Base URL should be started with protocol such as HTTP or HTTPS, for example: "http://localhost:1234/swagger".