Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema validation is not working and makes the api unusable #1937

Closed
ramiroll opened this issue Jun 19, 2023 · 0 comments
Closed

Schema validation is not working and makes the api unusable #1937

ramiroll opened this issue Jun 19, 2023 · 0 comments

Comments

@ramiroll
Copy link

Description

Hi,

I’m observing for the api manager 4.0.0 after taking update to level 203 for a gateway worker that the schema validation is broken. After enabling it I seeing the following trace:

[2023-05-31 18:51:48,857] ERROR - NativeWorkerPool Uncaught exception
java.lang.NoClassDefFoundError: io/swagger/util/Json
at com.atlassian.oai.validator.schema.SchemaValidator.lambda$new$0(SchemaValidator.java:92) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_352]
at com.atlassian.oai.validator.schema.SchemaValidator.(SchemaValidator.java:92) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator.(OpenApiInteractionValidator.java:149) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator.(OpenApiInteractionValidator.java:46) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator$Builder.build(OpenApiInteractionValidator.java:543) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.getOpenAPIValidator_aroundBody0(SchemaValidator.java:56) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.getOpenAPIValidator(SchemaValidator.java:47) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.handleRequest_aroundBody2(SchemaValidator.java:67) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.handleRequest(SchemaValidator.java:60) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.apache.synapse.api.API.process(API.java:389) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:108) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:128) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:60) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:84) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:70) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v63_3.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375) ~[synapse-nhttp-transport_2.1.7.wso2v227_46.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189) ~[synapse-nhttp-transport_2.1.7.wso2v227_46.jar:?]
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) [axis2_1.6.1.wso2v63_3.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_352]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_352]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_352]
Caused by: java.lang.ClassNotFoundException: io.swagger.util.Json cannot be found by swagger-request-validator-core_2.12.1.wso2v2
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:512) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:423) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:415) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]I
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:155) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_352]
... 26 more

In the past we have a similar issue 1, but in that case was because the following lines were not present in the repository/components/gateway-worker/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info file:
io.swagger.annotations,1.6.1,../plugins/io.swagger.annotations_1.6.1.jar,4,true
io.swagger.core,1.6.1,../plugins/io.swagger.core_1.6.1.jar,4,true
patch was done here 2

I’ve already checked in this case and the lines are there and the jars are properly placed in the plugins folder. With the oisg console I’ve checked the status of the bundle:
98 INSTALLED io.swagger.core_1.6.1
osgi> b 98
io.swagger.core_1.6.1 [98]
Id=98, Status=INSTALLED Data Root=/home/ramirol/servers/wso2am-4.0.0 203/GW/repository/components/gateway-worker/configuration/org.eclipse.osgi/98/data
"No registered services."
No services in use.

I’ve also checked the pom.xml files for swagger-request-validator-core_2.12.1.wso2v2.jar in both update levels and are the same file.

Please check this behavior and let me know if any other information is required

Thanks Ramiro

Steps to Reproduce

Setup a all in one node and a getway node for api manager 4.0.0 update level 203
Deploy pizzashack api
Enable schema validation
Invoke the api with the gateway node (the invokation works fine in the all in one node -> 1st GW)

Affected Component

APIM

Version

4.0.0

Environment Details (with versions)

ubuntu 20.04 LTS
openjdk version "1.8.0_352"

Relevant Log Output

[2023-05-31 18:51:48,857] ERROR - NativeWorkerPool Uncaught exception
java.lang.NoClassDefFoundError: io/swagger/util/Json
at com.atlassian.oai.validator.schema.SchemaValidator.lambda$new$0(SchemaValidator.java:92) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_352]
at com.atlassian.oai.validator.schema.SchemaValidator.(SchemaValidator.java:92) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator.(OpenApiInteractionValidator.java:149) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator.(OpenApiInteractionValidator.java:46) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at com.atlassian.oai.validator.OpenApiInteractionValidator$Builder.build(OpenApiInteractionValidator.java:543) ~[swagger-request-validator-core_2.12.1.wso2v2.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.getOpenAPIValidator_aroundBody0(SchemaValidator.java:56) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.getOpenAPIValidator(SchemaValidator.java:47) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.handleRequest_aroundBody2(SchemaValidator.java:67) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.wso2.carbon.apimgt.gateway.handlers.security.SchemaValidator.handleRequest(SchemaValidator.java:60) ~[org.wso2.carbon.apimgt.gateway_9.0.174.318.jar:?]
at org.apache.synapse.api.API.process(API.java:389) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.apiProcessNonDefaultStrategy(AbstractApiHandler.java:108) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.identifyAPI(AbstractApiHandler.java:128) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.AbstractApiHandler.dispatchToAPI(AbstractApiHandler.java:60) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.rest.RestRequestHandler.dispatchToAPI(RestRequestHandler.java:84) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.api.rest.RestRequestHandler.process(RestRequestHandler.java:70) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:54) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:344) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:101) ~[synapse-core_2.1.7.wso2v227_46.jar:2.1.7-wso2v227.46]
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) ~[axis2_1.6.1.wso2v63_3.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:375) ~[synapse-nhttp-transport_2.1.7.wso2v227_46.jar:?]
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:189) ~[synapse-nhttp-transport_2.1.7.wso2v227_46.jar:?]
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) [axis2_1.6.1.wso2v63_3.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_352]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_352]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_352]
Caused by: java.lang.ClassNotFoundException: io.swagger.util.Json cannot be found by swagger-request-validator-core_2.12.1.wso2v2
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:512) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:423) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:415) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]I
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:155) ~[org.eclipse.osgi_3.14.0.v20190517-1309.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[?:1.8.0_352]
... 26 more

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants