实施相互认证后重置连接

时间:2019-06-25 07:57:17

标签: java mutual-authentication

我已经在JavaCode中实现了基于证书的身份验证,我正在调用一个启用了相互身份验证的Web服务,因此他们给了我.crt.key文件。 实现所有功能后,在我的本地计算机上一切正常,但是在服务器中进行部署后,出现连接重置错误。以下是日志

[err] java.net.SocketException: Connection reset
[err]   at          java.net.SocketInputStream.read(SocketInputStream.java:221)
[err]   at java.net.SocketInputStream.read(SocketInputStream.java:152)
[err]   at com.ibm.jsse2.b.a(b.java:262)
[err]   at com.ibm.jsse2.b.a(b.java:33)
[err]   at com.ibm.jsse2.av.a(av.java:579)
[err]   at com.ibm.jsse2.av.i(av.java:574)
[err]   at com.ibm.jsse2.av.a(av.java:280)
[err]   at com.ibm.jsse2.av.startHandshake(av.java:431)
[err]   at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:275)
[err]   at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:254)
[err]   at org.apache.http.impl.conn.HttpClientConnectionOperator.connect(HttpClientConnectionOperator.java:123)
[err]   at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:318)
[err]   at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:363)
[err]   at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:219)
[err]   at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:195)
[err]   at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:86)
[err]   at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108)
[err]   at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
[err]   at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
[err]   at com.elux.aeg.common.rest.client.RestClient.executeRequest(RestClient.java:184)
[err]   at com.elux.aeg.common.rest.client.RestClient.execute(RestClient.java:127)
[err]   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[err]   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
[err]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
[err]   at java.lang.reflect.Method.invoke(Method.java:508)
[err]   at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:181)
[err]   at [internal classes]
[err]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
[err]   at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:268)
[err]   at com.ibm.mfp.server.java.adapter.shared.JAXRSSandbox$3.doFilter(JAXRSSandbox.java:579)
[err]   at com.ibm.mfp.server.java.adapter.shared.FilterChainImpl.doFilter(FilterChainImpl.java:86)
[err]   at com.ibm.mfp.server.java.adapter.shared.JAXRSSandbox.handleRequest(JAXRSSandbox.java:584)
[err]   at com.ibm.mfp.server.java.adapter.internal.rest.AdaptersEndpoint.adapterServing(AdaptersEndpoint.java:123)
[err]   at sun.reflect.GeneratedMethodAccessor209.invoke(Unknown Source)
[err]   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
[err]   at java.lang.reflect.Method.invoke(Method.java:508)
[err]   at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
[err]   at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
[err]   at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
[err]   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
[err]   at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
[err]   at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
[err]   at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
[err]   at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
[err]   at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
[err]   at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)
[err]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
[err]   at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
[err]   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
[err]   at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
[err]   at [internal classes]
[err]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
[err]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[err]   at java.lang.Thread.run(Thread.java:812)

我的本​​地机器上有oracle jdk,但是我的服务器上有ibm jdk。 所以我改变了

KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");

KeyManagerFactory kmf = KeyManagerFactory.getInstance("IbmX509");

但是我不知道发生了什么事。

请指导 TIA

0 个答案:

没有答案