I'm using wso2am-4.3.0 and I have disabled OpenAPI validation using the below switch to startup the server in order to import older APIs with validation errors.
-DswaggerRelaxedValidation=true
However, I get the below error in the log when invoking the API and the API fails to respond as well.
ERROR - ServerWorker Error processing GET request for : /xxxx/xxxx.
java.lang.NullPointerException: null
at io.swagger.v3.parser.converter.SwaggerConverter.lambda$addProperties$11(SwaggerConverter.java:1268) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at java.util.LinkedHashMap.forEach(LinkedHashMap.java:684) ~[?:?]
at io.swagger.v3.parser.converter.SwaggerConverter.addProperties(SwaggerConverter.java:1267) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:1225) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:865) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:635) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:535) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.convert(SwaggerConverter.java:250) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.readResult(SwaggerConverter.java:104) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.v3.parser.converter.SwaggerConverter.readContents(SwaggerConverter.java:99) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at io.swagger.parser.OpenAPIParser.readContents(OpenAPIParser.java:29) ~[swagger-parser_2.1.20.wso2v1.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler.setSwaggerToMessageContext_aroundBody8(APIMgtLatencyStatsHandler.java:134) ~[org.wso2.carbon.apimgt.gateway_9.29.120.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler.setSwaggerToMessageContext(APIMgtLatencyStatsHandler.java:1) ~[org.wso2.carbon.apimgt.gateway_9.29.120.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler.handleRequest_aroundBody4(APIMgtLatencyStatsHandler.java:98) ~[org.wso2.carbon.apimgt.gateway_9.29.120.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.common.APIMgtLatencyStatsHandler.handleRequest(APIMgtLatencyStatsHandler.java:1) ~[org.wso2.carbon.apimgt.gateway_9.29.120.jar:?]
at org.apache.synapse.api.API.process(API.java:407) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:109) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:129) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:61) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:90) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:76) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:350) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101) ~[synapse-core_4.0.0.wso2v105.jar:4.0.0-wso2v105]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v76.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:401) ~[synapse-nhttp-transport_4.0.0.wso2v105.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:215) ~[synapse-nhttp-transport_4.0.0.wso2v105.jar:?]
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) ~[axis2_1.6.1.wso2v76.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
at java.lang.Thread.run(Thread.java:834) ~[?:?]
A direction to resolve this issue is much appreciated. Thanks in advance.
The mentioned error trace can occur if the respective API's Swagger Definition has issues when loading to the Axis2 layer. WSO2 API Manager, loads the API swagger definitions in to memory during the API invocations when they are absent. Furthermore, while loading them, they go through a set of Parser implementations to properly load them to the Gateway component's memory to utilize those information for any validations during the API invocation period.
If you are seeing any reported linter issues with the respective API Swagger definition when creating the APIs in the API Manager, it would be good to check them and fix them and try the flow.
Furthermore, the mentioned -DswaggerRelaxedValidation=true
System property is used to bypass and relax the Swagger validation process during the API creation, and it is not applicable during the API invocation flows. So to overcome the mentioned error trace, it is good to revisit the Swagger definitions and fixing them.