javamavenjboss6.x

maven dependency - which dependency is using unwanted jar?


I am working on upgrading a complex maven project, with numerous pom files. The code is built using openjdk and it runs on jboss6.*

On starting up Jboss, I'm getting the following exception:

NoSuchMethodError: org.apache.http.conn.ssl.SSLConnectionSocketFactory.(Ljavax/net/ssl/SSLContext;Ljavax/net/ssl/HostnameVerifier;)V

Initially, it looked like I was not importing the right maven dependency.

I looked at the pom file for the project where the exception is thrown and I found the following dependency:

<dependency>
 <groupId>org.apache.httpcomponents</groupId>
 <artifactId>httpclient</artifactId>
 <version>4.5.5</version>
</dependency>

However, when adding the following line

LOGGER.debug(org.apache.http.conn.ssl.SSLConnectionSocketFactory.class.getProtectionDomain().getCodeSource().getLocation().getPath());

I get the following output:

11:54:37,037 DEBUG [packageobsucated.httpclient.HttpClientConfigUtil] (ServerService Thread Pool -- 69) file:/server/modules/system/layers/base/org/apache/httpcomponents/main/httpclient-4.3.6.redhat-1.jar!/

How can I find out which maven dependency is using httpclient-4.3.6.redhat-1.jar?

I have called mvn dependency:tree on the parent pom.xml file but I'm afraid I cannot find anything with that exact description.

Thanks in advance,


Solution

  • I am not jboss expert, but I guess that this dependency is loaded from a module inside jboss, i.e. not from your war.

    So I guess you need to look for the order of class loading in your jboss if you want to use a different version of httpclient.