hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zindel, Andreas" <Andreas.Zin...@eads.net>
Subject javax.servlet.ServletException: org.apache.http.conn.ssl.SSLInitializationException: Failure initializing default SSL context
Date Wed, 14 May 2014 13:47:20 GMT
Hello,

I'm using the Apache Jena API in a Jersey web service. The Jena API uses the HTTPClient API.
When I call specific Jena functions I get an:

javax.servlet.ServletException: org.apache.http.conn.ssl.SSLInitializationException: Failure
initializing default SSL context

The Jersey web service runs on a Glassfish Application Server locally for testing. I don't
know much about SSL so my research hasn't got me anywhere near  a solution. Maybe a member
of the mailing list get give me a hint in the right direction. I wrote a small example web
service that gives me the same error message:

@Path("/test/client/")
public class TestHttpClient {

       @GET
       @Path("http")
       public Response testClient() {

              HttpClient httpclient = new DefaultHttpClient();
              HttpGet httpget = new HttpGet("http://www.verisign.com/");

              try {

                     HttpResponse response = httpclient.execute(httpget);
                  System.out.println(response.getStatusLine());

              }
              catch (ClientProtocolException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
              }
              catch (IOException e) {
                     // TODO Auto-generated catch block
                     e.printStackTrace();
              }
              finally {

                     httpget.releaseConnection();
              }

              return Response.status(201).entity("service still running!").build();
       }
}

This gives me the following error message:

2014-05-14T15:45:35.737+0200|Warning: StandardWrapperValve[Jersey Web Application]: Servlet.service()
for servlet Jersey Web Application threw exception
java.security.KeyStoreException: problem accessing trust storejava.io.IOException: Keystore
was tampered with, or password was incorrect
       at sun.security.ssl.TrustManagerFactoryImpl.engineInit(TrustManagerFactoryImpl.java:75)
       at javax.net.ssl.TrustManagerFactory.init(TrustManagerFactory.java:250)
       at org.apache.http.conn.ssl.SSLSocketFactory.createSSLContext(SSLSocketFactory.java:229)
       at org.apache.http.conn.ssl.SSLSocketFactory.createDefaultSSLContext(SSLSocketFactory.java:358)
       at org.apache.http.conn.ssl.SSLSocketFactory.getSocketFactory(SSLSocketFactory.java:175)
       at org.apache.http.impl.conn.SchemeRegistryFactory.createDefault(SchemeRegistryFactory.java:49)
       at org.apache.http.impl.client.AbstractHttpClient.createClientConnectionManager(AbstractHttpClient.java:306)
       at org.apache.http.impl.client.AbstractHttpClient.getConnectionManager(AbstractHttpClient.java:466)
       at org.apache.http.impl.client.AbstractHttpClient.createHttpContext(AbstractHttpClient.java:286)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:851)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
       at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:784)
       at com.airbus.group.iw.webservices.TestHttpClient.testClient(TestHttpClient.java:29)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
       at java.lang.reflect.Method.invoke(Method.java:606)
       at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
       at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
       at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
       at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
       at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
       at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
       at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
       at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
       at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
       at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
       at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
       at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
       at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
       at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
       at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
       at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:323)
       at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
       at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
       at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
       at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160)
       at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673)
       at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174)
       at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:357)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:260)
       at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:188)
       at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
       at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
       at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
       at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
       at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
       at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
       at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
       at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
       at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
       at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
       at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
       at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
       at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
       at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
       at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
       at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
       at java.lang.Thread.run(Thread.java:744)

Any help is appreciated.

Greetings


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message