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

marklogic-client-api jar in classpath causes ReST calls to to throw ClassNotFoundException #1669

Open
mathurashwin opened this issue May 7, 2024 · 2 comments
Assignees

Comments

@mathurashwin
Copy link

mathurashwin commented May 7, 2024

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):

  1. 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.
  2. 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

@rjrudin
Copy link
Contributor

rjrudin commented Jun 4, 2024

Hi @mathurashwin - it sounds like this is generic to the MarkLogic Java Client and not to the Data Hub. Are you actually using https://central.sonatype.com/artifact/com.marklogic/marklogic-data-hub in your application, or just com.marklogic:marklogic-client-api?

@rjrudin rjrudin transferred this issue from marklogic/marklogic-data-hub Jun 4, 2024
@rjrudin
Copy link
Contributor

rjrudin commented Jun 4, 2024

Transferred this issue to the Java Client. @mathurashwin You're absolutely right in your diagnosis, I believe this file has long been overlooked. We'll get a patch release out very soon to remove the file.

Please let us know if you're using com.marklogic:marklogic-data-hub as a dependency or just com.marklogic:marklogic-client-api.

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

No branches or pull requests

2 participants