我有一个运行良好的密钥库文件。我使用下面的命令::
测试了它root@server # java -Djavax.net.ssl.trustStore=/tmp/apache-servicemix-7.0.0/deploy/qpid.jks SSLPoke esesslx0ghk.se 9443
Successfully connected
现在我正在使用ServiceMix部署qpid applcation来路由队列。
我的配置如下::
<bean id="amqp" class="org.apache.camel.component.amqp.AMQPComponent">
<property name="connectionFactory">
<bean class="org.apache.qpid.jms.JmsConnectionFactory">
<property name="remoteURI" value="amqps://esesslx0ghk.se:9443?transport.keyStoreLocation=/tmp/apache-servicemix-7.0.0/deploy/qpid.jks&transport.keyStorePassword=test123" />
</bean>
</property>
</bean>
但是当我运行我的应用程序时,我得到了ERROR ::
2017-05-10 17:30:02,591 | ERROR | mer[CSDP_output] | JmsConnectionFactory | 226 - qpid-jms-client.jar - 0.0.0 | Failed to create JMS Provider instance for: amqps
2017-05-10 17:30:02,619 | ERROR | mer[CSDP_output] | faultJmsMessageListenerContainer | 155 - org.apache.servicemix.bundles.spring-jms - 3.2.17.RELEASE_1 | Could not refresh JMS Connection for destination 'CSDP_output' - retrying in 5000 ms. Cause: Failed to create connection to: amqps://esesslx0ghk.se:9443?transport.keyStoreLocation=%252Ftmp%252Fapache-servicemix-7.0.0%252Fdeploy%252Fqpidd.jks&transport.keyStorePassword=test123; nested exception is javax.net.ssl.SSLHandshakeException: General SSLEngine problem
javax.jms.JMSException: Failed to create connection to: amqps://esesslx0ghk.se:9443?transport.keyStoreLocation=%252Ftmp%252Fapache-servicemix-7.0.0%252Fdeploy%252Fqpidd.jks&transport.keyStorePassword=test123
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1478)[:1.8.0_121]
at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:535)[:1.8.0_121]
at sun.security.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:813)[:1.8.0_121]
at sun.security.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:781)[:1.8.0_121]
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:624)[:1.8.0_121]
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)[:1.8.0_121]
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)[:1.8.0_121]
at sun.security.validator.Validator.validate(Validator.java:260)[:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)[:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:281)[:1.8.0_121]
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:136)[:1.8.0_121]
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1501)[:1.8.0_121]
... 21 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141)[:1.8.0_121]
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126)[:1.8.0_121]
现在,我一方面100%确定我拥有的密钥库文件是正确的,并且其路径已正确配置。但是应用程序无法接收它。这条线路有问题吗?
<property name="remoteURI" value="amqps://esesslx0ghk.se:9443?transport.keyStoreLocation=/tmp/apache-servicemix-7.0.0/deploy/qpidd.jks&transport.keyStorePassword=test123" />
答案 0 :(得分:2)
您正在将客户端交给密钥存储区,但通常您应该将其交给信任存储区,因为这会告诉客户端它信任哪些服务器证书。您只在进行相互身份验证时提供密钥存储,并且客户端需要向远程提供证书。
我的第一个建议是设置客户端documentation中定义的transport.trustStoreLocation。
如果这不起作用,那么就该分解并对SSL handshake进行一些调试。