0
votes

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [gts.efx.web.login.LogInController]: Constructor threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving method "javax.net.ssl.SSLContext.getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/http/conn/ssl/SSLConnectionSocketFactory, and the class loader (instance of ) for resolved class, javax/net/ssl/SSLContext, have different Class objects for the type javax/net/ssl/SSLSocketFactory used in the signature

This error comes up after adding the dependency

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

If i don't add this dependency i get

java.lang.NoClassDefFoundError: org/apache/http/conn/HttpClientConnectionManager
        at gts.efx.web.login.LogInController.<init>(LogInController.java:51)

Any help ? Thanks in advance.

1

1 Answers

0
votes

Because adding that dependency puts two implementations of

javax/net/ssl/SSLSocketFactory

On the classpath. And they are not compatible.

You give very little info about the platform you are using, but it seems to be JBOSS.

It would seem that server is not compatible with the apache httpclient library.