2017-05-10 98 views
0

我有一個很好的keystore文件。我曾嘗試使用下面的命令::無法在Qpid配置文件中加載KeyStore文件

[email protected] # 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&amp;transport.keyStorePassword=test123" /> 
     </bean> 
    </property> 
    </bean> 

但是當我運行我的應用程序,我得到的錯誤::

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&amp;transport.keyStorePassword=test123" /> 

回答

2

你交給客戶端密鑰存儲但一般而言,您應該交給其信任存儲因爲這是告訴它信任的服務器證書的客戶端。您只在進行相互認證時才提供密鑰存儲,並且客戶端需要向遠程提供證書。

我的第一個建議是設置客戶端documentation中定義的transport.trustStoreLocation。

如果這不起作用,那麼是時候分解並對SSL handshake進行一些調試。

+0

謝謝。將其更改爲'transport.trustStoreLocation'工作。 –