Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Error establiching connection with consul server #56

Closed
GLE81 opened this issue Aug 14, 2015 · 10 comments
Closed

Error establiching connection with consul server #56

GLE81 opened this issue Aug 14, 2015 · 10 comments

Comments

@GLE81
Copy link

GLE81 commented Aug 14, 2015

Hi,

I'm trying to integrate consul-client in my webapplication. I'm executing a test where everytime that the library try to connect to the consul server retrieve the following error "java.lang.NoSuchMethodError: javax.ws.rs.core.Response.close()V" in the line 79 of agentClient. I tried to debug or fix this error but every source code I download doesn't compile, it has errors of no class found like ImmutableCheck and ImmutableRegistration that aren't in the project.

I don't know if I forget something or if I have something wrong.

<dependency>
  <groupId>com.orbitz.consul</groupId>
  <artifactId>consul-client</artifactId>
  <version>0.9.8</version>
</dependency>
    <dependency>
   <groupId>org.apache.cxf</groupId>
   <artifactId>cxf-rt-rs-client</artifactId>
   <version>3.0.4</version>
    </dependency>

I'm using Spring 4.0.7.RELEASE.

@rickfast
Copy link
Owner

Hi
Looks like a JAX-RS version conflict on your classpath. As far as ImmutableCheck goes, this is a new change in 0.9.8 that I think might still need some work. The class in question is supposed to be generated dynamically, but a number of people have had issues with it. Suggest you try 0.9.7 instead, which is quite stable. I'm working to fix issues with 0.9.8.

@gjesse
Copy link
Contributor

gjesse commented Aug 14, 2015

For the Immutable* classes you need to setup your IDE to process the annotations - see http://immutables.github.io/apt.html for more info. (Note I also had to manually mark the 'generated-sources' folder as a "generated source root" in intellij)

@rickfast unless you are thinking of removing these i can add some instructions to the README about it

@gjesse
Copy link
Contributor

gjesse commented Aug 14, 2015

Also, @GLE81, I tried replicating your error with a minimal setup and it worked fine, so I think Rick is correct about the source of your original issue.

@rickfast
Copy link
Owner

I haven't played with 0.9.8 yet, but a coworker had issues. We should add a Development section on the README.

@rickfast
Copy link
Owner

@GLE81 you should have javax.ws.rs:javax.ws.rs-api:2.0.1 on your classpath, and no other JAX-RS API versions.

If you're using Gradle, you can inspect version clashes with

./gradlew dependencyInsight --dependency=javax.ws.rs-api

which will show if there's two versions on the classpath.

@gjesse
Copy link
Contributor

gjesse commented Aug 14, 2015

We should add a Development section on the README.

I can write something up today for it

@GLE81
Copy link
Author

GLE81 commented Aug 17, 2015

Hi,

I tried with version 0.9.7 and dependency javax.ws.rs:javax.ws.rs-api:2.0.1 and it still doesn't work. I'm continuing looking if I can find the problem anyway here is my pom.xml.

4.0.9.RELEASE 1.2.17 1.7 SpringRestSecurityOauth 3.2.5.RELEASE junit junit 4.11 test org.mortbay.jetty jsp-2.1 6.0.0 org.apache.commons commons-io 1.3.2 log4j log4j ${log4j.version} org.springframework spring-web ${spring.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-beans ${spring.version} org.springframework spring-test ${spring.version} test org.springframework.security spring-security-web ${spring.security.version} org.springframework.security spring-security-config ${spring.security.version} org.springframework.security.oauth spring-security-oauth2 2.0.7.RELEASE com.google.code.gson gson 2.2.2 org.codehaus.jackson jackson-mapper-asl 1.9.10 commons-httpclient commons-httpclient 3.1 org.springframework spring-context-support ${spring.version} javax.servlet javax.servlet-api 3.0.1 provided com.indra.security.oauth2 springSecurityOauth2Client 0.1 com.orbitz.consul consul-client 0.9.7 org.apache.cxf cxf-rt-rs-client 3.0.3 org.apache.cxf cxf-rt-transports-http-hc 3.0.3 javax.ws.rs javax.ws.rs-api 2.0.1 ${pom.artifactId} maven-compiler-plugin ${jdk.version} ${jdk.version}
    </plugins>
</build>

@GLE81
Copy link
Author

GLE81 commented Aug 17, 2015

OK. I just imported the 0.9.7 source code in my workspace and now is working, I'm going to continue testing to find what happened when I use the library.

@gjesse
Copy link
Contributor

gjesse commented Aug 17, 2015

@GLE81, I'm not sure that's a good solution - likely it's altering the classpath in your dev environment, but it could be that the issue still occurs when you build for alternate environments.

I recommend that you run mvn dependency:tree from the command line - that will list all your dependencies, and their dependencies in turn to see which one is pulling in the conflicting javax.ws.rs-api version.

You could also then try experimenting with excluding the conflicting dependency.

@rickfast
Copy link
Owner

@GLE81 is this still an issue? If not, I'm going to close this issue. Thanks

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

No branches or pull requests

3 participants