违反加载程序约束:解析方法时“javax.net.ssl.SSLContext.getSocketFactory()

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

添加依赖项后出现此错误

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

如果我不添加此依赖项,我会得到

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

有什么帮助吗?提前致谢。

因为添加该依赖项会产生

的两个实现
javax/net/ssl/SSLSocketFactory

在类路径上。而且不兼容。

关于您正在使用的平台,您提供的信息很少,但似乎是 JBOSS。

服务器似乎与 apache httpclient 库不兼容。