升级到WAS Liberty Profile的最新版本后,我们对IBM Weather API的JAX-RS客户端请求不再起作用。 (Liberty版本17.0.0.1)。我记得我在server.xml中配置证书存储库时遇到了麻烦,但它运行正常。在Liberty中我遗失或可能已经改变的任何想法? (或者只是如何配置defaultKeyStore keyStore?)
[3/16/17 23:42:33:426 CET] 000002f0 com.servengine.ws.rs.ThrowableExceptionMapper E Exception javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking https://ID_PWD@twcservice.mybluemix.net/api/weather/v1/geocode/29.06294/-13.59026/forecast/daily/10day.json?units=m&language=es: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath. handled by ThrowableExceptionMapper
javax.ws.rs.ProcessingException: javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking https://ID_PWD@twcservice.mybluemix.net/api/weather/v1/geocode/29.06294/-13.59026/forecast/daily/10day.json?units=m&language=es: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath.
at org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:624)
at org.apache.cxf.jaxrs.client.AbstractClient.preProcessResult(AbstractClient.java:606)
at org.apache.cxf.jaxrs.client.WebClient.doResponse(WebClient.java:1098)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1035)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:892)
at org.apache.cxf.jaxrs.client.WebClient.doInvoke(WebClient.java:863)
at org.apache.cxf.jaxrs.client.WebClient.invoke(WebClient.java:426)
at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1547)
at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.method(WebClient.java:1542)
at org.apache.cxf.jaxrs.client.WebClient$SyncInvokerImpl.get(WebClient.java:1462)
at org.apache.cxf.jaxrs.client.spec.InvocationBuilderImpl.get(InvocationBuilderImpl.java:80)
at com.servengine.weather.IBMInsights4WeatherRESTClient.getJsonObject(IBMInsights4WeatherRESTClient.java:86)
at com.servengine.weather.IBMInsights4WeatherRESTClient.getForecastDaily10Day(IBMInsights4WeatherRESTClient.java:92)
at com.servengine.weather.IBMInsights4WeatherRESTClient$Proxy$_$$_WeldClientProxy.getForecastDaily10Day(Unknown Source)
at com.servengine.eliza.tourism.ws.rs.app.OrganizationServiceResource.getForecastDaily10Day(OrganizationServiceResource.java:238)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at com.ibm.ws.jaxrs20.cdi.component.JaxRsFactoryImplicitBeanCDICustomizer.serviceInvoke(JaxRsFactoryImplicitBeanCDICustomizer.java:273)
at com.ibm.ws.jaxrs20.server.LibertyJaxRsServerFactoryBean.performInvocation(LibertyJaxRsServerFactoryBean.java:659)
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.performInvocation(LibertyJaxRsInvoker.java:115)
at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:210)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189)
at com.ibm.ws.jaxrs20.server.LibertyJaxRsInvoker.invoke(LibertyJaxRsInvoker.java:381)
at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:61)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:99)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:124)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
at com.ibm.ws.jaxrs20.endpoint.AbstractJaxRsWebEndpoint.invoke(AbstractJaxRsWebEndpoint.java:134)
at com.ibm.websphere.jaxrs.server.IBMRestServlet.handleRequest(IBMRestServlet.java:149)
at com.ibm.websphere.jaxrs.server.IBMRestServlet.doGet(IBMRestServlet.java:115)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at com.ibm.websphere.jaxrs.server.IBMRestServlet.service(IBMRestServlet.java:99)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1290)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:778)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:475)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1157)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:82)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:945)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: javax.net.ssl.SSLHandshakeException: SSLHandshakeException invoking https://ID_PWD@twcservice.mybluemix.net/api/weather/v1/geocode/29.06294/-13.59026/forecast/daily/10day.json?units=m&language=es: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath.
at sun.reflect.GeneratedConstructorAccessor110.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
at java.lang.reflect.Constructor.newInstance(Constructor.java:437)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1377)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1361)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:651)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.jaxrs.client.AbstractClient.doRunInterceptorChain(AbstractClient.java:693)
at org.apache.cxf.jaxrs.client.WebClient.doChainedInvocation(WebClient.java:1034)
... 56 more
Caused by: javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath.
at com.ibm.jsse2.j.a(j.java:3)
at com.ibm.jsse2.as.a(as.java:213)
at com.ibm.jsse2.C.a(C.java:339)
at com.ibm.jsse2.C.a(C.java:248)
at com.ibm.jsse2.D.a(D.java:291)
at com.ibm.jsse2.D.a(D.java:217)
at com.ibm.jsse2.C.r(C.java:373)
at com.ibm.jsse2.C.a(C.java:352)
at com.ibm.jsse2.as.a(as.java:752)
at com.ibm.jsse2.as.i(as.java:338)
at com.ibm.jsse2.as.a(as.java:711)
at com.ibm.jsse2.as.startHandshake(as.java:454)
at com.ibm.net.ssl.www2.protocol.https.c.afterConnect(c.java:182)
at com.ibm.net.ssl.www2.protocol.https.d.connect(d.java:20)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1561)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1489)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:491)
at com.ibm.net.ssl.www2.protocol.https.b.getResponseCode(b.java:60)
at org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:332)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1578)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1607)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1551)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1348)
... 62 more
Caused by: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath.
at com.ibm.ws.ssl.core.WSX509TrustManager.checkServerTrusted(WSX509TrustManager.java:322)
at com.ibm.jsse2.ay.checkServerTrusted(ay.java:3)
at com.ibm.jsse2.D.a(D.java:588)
... 80 more
答案 0 :(得分:0)
您必须添加签名证书 https://ID_PWD@twcservice.mybluemix.net 到你的信任库。
通过
将其导入配置的信任库 keytool -import -alias YOUR_ALIAS -file YOUR-DONWLOADED_CERTIFICATE.cer - keystore YOUR-LIBERTY-TRUSTSTORE
keytool是一个二进制文件,位于JDK / bin路径
中