简体   繁体   中英

loader constraint violation: when resolving method "javax.net.ssl.SSLContext.getSocketFactory()

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM