Search code examples
websphereapache-httpclient-4.x

Websphere HttpClient java.lang.NoSuchMethodError: org/apache/http/conn/ssl/SSLSocketFactory.<init>


I have a webapp that needs to be deployed to Websphere 8.5, (it works fine in tomcat 7). This app calls the REST webservice of another app, and uses HttpClient for that. When I start the app I get the following error:

Caused by: java.lang.NoSuchMethodError: org/apache/http/conn/ssl/SSLSocketFactory.<init>(Ljavax/net/ssl/SSLContext;Lorg/apache/http/conn/ssl/X509HostnameVerifier;)V
        at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.initDefaultEngine(ResteasyClientBuilder.java:418)
        at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:333)
        at org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder.build(ResteasyClientBuilder.java:49)
        at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:114)
        at com.qmino.matrix.calculation.engine.EngineInstance.<init>(EngineInstance.java:23)
        at com.qmino.matrix.calculation.engine.CalculationEngine.<init>(CalculationEngine.java:61)
        at com.qmino.matrix.calculation.engine.ThreadPool.<init>(ThreadPool.java:29)
        at com.qmino.matrix.calculation.engine.application.Application.getThreadPool(Application.java:53)
        at com.qmino.matrix.calculation.engine.application.Application$$EnhancerBySpringCGLIB$$57778e16.CGLIB$getThreadPool$0(<generated>)
        at com.qmino.matrix.calculation.engine.application.Application$$EnhancerBySpringCGLIB$$57778e16$$FastClassBySpringCGLIB$$d67ab8c2.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
        at com.qmino.matrix.calculation.engine.application.Application$$EnhancerBySpringCGLIB$$57778e16.getThreadPool(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at java.lang.reflect.Method.invoke(Method.java:611)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
        ... 120 more

I've found this question but it wasn't really helpfull. Can anybody help me with this?


Solution

  • Httpclient libraries conflict with WebSphere provided. Please try to create isolated shared library via Environment > Shared libraries, put the http client jars there and map that library to the application. See more details in this post WebSphere 8.5 and Apache HTTP Client