marklogic-data-hub
marklogic-data-hub copied to clipboard
marklogic-client-api jar in classpath causes ReST calls to to throw ClassNotFoundException
If you are a licensed MarkLogic customer, please contact Support first.
If you are a MarkLogic employee, please use our internal JIRA instance to report an issue of type Bug in the DHFPROD project.
Otherwise, please use this template to report the bug you've run into.
The issue
Please provide reproducible steps for the issue and a description of what behavior you expected instead.
The steps to reproduce the issue (use as many numbered steps as you need):
- Create a java project with a ReST call using the jakarta JAX-RS api and have the marklogic-client-api jar and any other JAX-RS implementing jars like like CXF (cxf-rt-frontend-jaxrs), Resteasy, etc. in the classpath. Make sure the marklogic jar is BEFORE the other implementing jars (CXF, Resteasy, etc.) in the classpath.
- When the rest call is invoked, you will see a ClassNotFoundException for the class org.glassfish.jersey.internal.RuntimeDelegateImpl
What behavior were you expecting? Expecting the rest call to go through without any errors as a valid implementation of JAX-RS is provided
Technical details
Please provide the following version information:
- Operating System = CentOS
- MarkLogic = marklogic-client-api-5.5.1
- Data Hub =
If this is a Hub Central or QuickStart issue, please provide the browser version too:
Additional details
This error happens because the marklogic-client-api jar contains a reference to the com.marklogic.client.impl.MockRuntimeDelegate class in the META-INF/services/javax.ws.rs.ext.RuntimeDelegate file. The JAX-RS api uses the ServiceLoader to look for implementations of javax.ws.rs.ext.RuntimeDelegate and picks the first it finds in the classpath which, in this case, will be the com.marklogic.client.impl.MockRuntimeDelegate class which it cannot find. It then defaults to the default class which is org.glassfish.jersey.internal.RuntimeDelegateImpl which isnt found as well and hence the ClassNotFoundException. I'm assuming the reference to the MockRuntimeDelegate class was put in there for some testing as its called a 'Mock' and this file should never have been packaged with the released jar file. Removing this file should fix this issue