Я использую компонент camel-rabbitmq для связи rabbitMQ через SSL.
Согласно документу компонента rabbitMQ для включения только SSL * достаточно параметра sslProtocal .По умолчанию JVM SSLcontext будет загружен и проверит сертификат сервера на основе / lib / security / cacerts файла (или) аргументов JVM.
Подробная информация представлена в этой ссылке: - https://docs.oracle.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#CustomizingStores
Я предоставил файлы хранилища ключей в аргументах JVM, запустил файл чертежа ниже и получил ошибку ниже;
BluePrint.xml
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<bean id="customConnectionFactory" class="com.rabbitmq.client.ConnectionFactory">
<property name="host" value="127.0.0.1"/>
<property name="port" value="5671"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="rabbitmq://rmqEx?queue=queue&routingKey=rmqRoutekey&sslProtocol=TLSv1.2"/>
<to uri="log:msgdestroy"/>
</route>
</camelContext>
</blueprint>
Журнал ошибок: -
2018-05-27T00:38:11,569 | INFO | Camel (camel-1) thread #1 - RabbitMQConsumer | RabbitConsumer | 58 - org.apache.camel.camel-rabbitmq - 2.21.0 | Attempting to open a new rabbitMQ channel
2018-05-27T00:38:11,583 | INFO | Camel (camel-1) thread #1 - RabbitMQConsumer | RabbitMQConsumer | 56 - org.apache.camel.camel-core - 2.21.0 | Connection failed, will retry in 5000ms
java.io.IOException: null
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:126) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:122) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:362) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:64) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:99) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:948) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:907) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:865) [53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1049) [53:com.rabbitmq.client:5.1.2]
at org.apache.camel.component.rabbitmq.RabbitMQEndpoint.connect(RabbitMQEndpoint.java:228) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at org.apache.camel.component.rabbitmq.RabbitMQConsumer.openConnection(RabbitMQConsumer.java:64) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at org.apache.camel.component.rabbitmq.RabbitMQConsumer.getConnection(RabbitMQConsumer.java:75) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at org.apache.camel.component.rabbitmq.RabbitConsumer.reconnect(RabbitConsumer.java:307) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at org.apache.camel.component.rabbitmq.RabbitMQConsumer$StartConsumerCallable.call(RabbitMQConsumer.java:216) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at org.apache.camel.component.rabbitmq.RabbitMQConsumer$StartConsumerCallable.call(RabbitMQConsumer.java:196) [58:org.apache.camel.camel-rabbitmq:2.21.0]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
at java.lang.Thread.run(Thread.java:748) [?:?]
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66) ~[53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36) ~[53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:494) ~[53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:306) ~[53:com.rabbitmq.client:5.1.2]
... 16 more
Caused by: java.io.EOFException
at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:290) ~[?:?]
at com.rabbitmq.client.impl.Frame.readFrom(Frame.java:91) ~[53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(SocketFrameHandler.java:164) ~[53:com.rabbitmq.client:5.1.2]
at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:580) ~[53:com.rabbitmq.client:5.1.2]
... 1 more
Есть еще один параметр для настройки «TrustManger».Диспетчер доверия ограничен SSLContext, поэтому мы не можем связать SSLcontext в диспетчере доверия.В компоненте camel-rabbitmq нет параметра "SSLContext" для его хранения.
http://camel.apache.org/camel-configuration-utilities.html
Пожалуйста, дайте мне знать, как решить эту проблему с подключением.