3
votes

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,

1
If you are running in jboss, it may be that the container is providing the jar. I'm not familiar with it but the path /server/modules/system/layers/ makes me think it is probably the container. Effectively, some library you are using is compiled against a different version of httpclient than the one jboss is providing. - Michael
If that is the case, you want to exclude the module from jboss á la stackoverflow.com/questions/47759298/… - Michael
@Michael Sorry, I missed your comment while I was writing the answer (no intend to copy your idea). - J Fabian Meier

1 Answers

2
votes

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.