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

java.lang.RuntimeException: java.lang.ClassNotFoundException: Class 'org.glassfish.jersey.client.JerseyClientBuilder' was not found #103

Open
1 of 3 tasks
AndrewCopeland opened this issue Nov 12, 2020 · 2 comments

Comments

@AndrewCopeland
Copy link
Contributor

Summary

When attempting to use the Conjur client I am receiving the following exception:

java.lang.RuntimeException: java.lang.ClassNotFoundException: Class 'org.glassfish.jersey.client.JerseyClientBuilder' was not found
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:103)
	at com.cyberark.conjur.api.clients.ResourceClient.init(ResourceClient.java:81)
	at com.cyberark.conjur.api.clients.ResourceClient.<init>(ResourceClient.java:35)
	at com.cyberark.conjur.api.Variables.<init>(Variables.java:17)
	at com.cyberark.conjur.api.Conjur.<init>(Conjur.java:81)
	at com.cyberark.conjur.api.Conjur.<init>(Conjur.java:43)
	at com.cyberark.ConjurBuildStartContextProcessor.updateParameters(ConjurBuildStartContextProcessor.java:127)
	at jetbrains.buildServer.serverSide.impl.RunningBuildImpl.prepareRunners(RunningBuildImpl.java:265)
	at jetbrains.buildServer.serverSide.impl.RunningBuildImpl.createAgentBuild(RunningBuildImpl.java:412)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.startBuild(BuildStarter.java:146)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.lambda$null$0(BuildStarter.java:73)
	at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.lambda$startBuildAsync$1(BuildStarter.java:88)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: Class 'org.glassfish.jersey.client.JerseyClientBuilder' was not found
	at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.doLoadClass(TeamCityClassLoader.java:85)
	at jetbrains.buildServer.plugins.classLoaders.TeamCityClassLoader.loadClass(TeamCityClassLoader.java:40)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:315)
	at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:113)
	at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206)
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:86)
	... 17 more

Steps to Reproduce

My code that is throwing this error:

Conjur conjur = new Conjur(authnLogin, apiKey, getSSLContext(certFile));
String value = conjur.variables().retrieveSecret("db/postgres/username");
System.out.println("THIS IS THE VALUE: " + value);

Expected Results

Retrieve a secret successfuly.

Actual Results (including error logs, if applicable)

java.lang.RuntimeException: java.lang.ClassNotFoundException

Reproducible

  • Always
  • Sometimes
  • Non-Reproducible

Version/Tag number

3.0.2

Environment setup

Running inside of container to container. Local dev environment

Additional Information

@AndrewCopeland
Copy link
Contributor Author

I was able to resolve the error above by including the following dependency in my pom.xml:

    <dependency>
      <groupId>org.glassfish.jersey.core</groupId>
      <artifactId>jersey-client</artifactId>
      <version>3.0.0-M6</version>
    </dependency>

Now I am receiving the following exception:

java.lang.LinkageError: ClassCastException: attempting to castjar:file:/data/teamcity_server/datadir/system/caches/plugins.unpacked/teamcity/server/javax.ws.rs-api-2.0.jar!/javax/ws/rs/client/ClientBuilder.class to jar:file:/data/teamcity_server/datadir/system/caches/plugins.unpacked/teamcity/server/javax.ws.rs-api-2.0.jar!/javax/ws/rs/client/ClientBuilder.class
	at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:97)
	at com.cyberark.conjur.api.clients.ResourceClient.init(ResourceClient.java:81)
	at com.cyberark.conjur.api.clients.ResourceClient.<init>(ResourceClient.java:35)
	at com.cyberark.conjur.api.Variables.<init>(Variables.java:17)
	at com.cyberark.conjur.api.Conjur.<init>(Conjur.java:81)
	at com.cyberark.conjur.api.Conjur.<init>(Conjur.java:43)
	at com.cyberark.ConjurBuildStartContextProcessor.updateParameters(ConjurBuildStartContextProcessor.java:127)
	at jetbrains.buildServer.serverSide.impl.RunningBuildImpl.prepareRunners(RunningBuildImpl.java:265)
	at jetbrains.buildServer.serverSide.impl.RunningBuildImpl.createAgentBuild(RunningBuildImpl.java:412)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.startBuild(BuildStarter.java:146)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.lambda$null$0(BuildStarter.java:73)
	at jetbrains.buildServer.util.NamedThreadFactory.executeWithNewThreadName(NamedThreadFactory.java:76)
	at jetbrains.buildServer.serverSide.impl.BuildStarter.lambda$startBuildAsync$1(BuildStarter.java:88)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
[2020-11-12 21:30:06,206]   WARN [0@72272817"; Normal executor 3] -   jetbrains.buildServer.SERVER - Error while starting build {id=2001}

I also decided to include the following dependency but the exception still occurs:

    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.0</version>
    </dependency>

@JfcAtCyberArk
Copy link
Contributor

Hey @AndrewCopeland,

I also ran into issues with dependencies and tried to gather info in here: https://discuss.cyberarkcommons.org/t/conjur-and-clojure/909/5

Thanks,
JFC

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

No branches or pull requests

3 participants