Enable SSL in hornetq netty-connector with AS 7.2 as a client using pooled-connection-factory and outbound-socket-binding
lifeonatrip Jun 29, 2014 10:27 PMHello all,
I have a question in regards the use of pooled connection factory with a SSL-enabled netty connector.
The setup is as following:
- 2 instances of jboss as 7.2
- Instance A is used as an Application Server (client)
- Instance B is used only as queue server (HornetQ)
The application deployed in instance A leverage on the AS' pooled-connection-factory to connect to Instance B. Below the portion of the configuration in Instance A:
<pooled-connection-factory name="PooledXAConnectionFactory"> <ha>true</ha> <user>USER</user> <password>PASS</password> <!--consumer-window-size>0</consumer-window-size--> <reconnect-attempts>3</reconnect-attempts> <retry-interval-multiplier>1.0</retry-interval-multiplier> <retry-interval>1000</retry-interval> <transaction mode="xa"/> <connectors> <connector-ref connector-name="remote-netty-connector"/> </connectors> <entries> <entry name="java:/PooledXAConnectionFactory"/> </entries> </pooled-connection-factory>
This is the connectors part inside <hornetq-server>:
<connectors> <in-vm-connector name="in-vm" server-id="0"/> <netty-connector name="remote-netty-connector" socket-binding="messaging1"/> </connectors>
And this is the outbound socket binding inside <socket-binding-group>:
<outbound-socket-binding name="messaging1"> <remote-destination host="10.20.103.87" port="5595"/> </outbound-socket-binding>
In instance B (the actual queue server), the configuration of the netty connector and acceptor referenced in the Instance A as "messaging1" is as following:
<netty-connector name="messaging1" socket-binding="messaging"> <param key="ssl-enabled" value="true"/> <param key="key-store-path" value="${jboss.domain.config.dir}/keystore.ks"/> <param key="trust-store-path" value="${jboss.domain.config.dir}/truststore.ks"/> <param key="trust-store-password" value="changeit"/> <param key="key-store-password" value="changeit"/> </netty-connector>
<netty-acceptor name="messaging1" socket-binding="messaging"> <param key="ssl-enabled" value="true"/> <param key="key-store-path" value="${jboss.domain.config.dir}/keystore.ks"/> <param key="trust-store-path" value="${jboss.domain.config.dir}/keystore.ks"/> <param key="trust-store-password" value="changeit"/> <param key="key-store-password" value="changeit"/> <param key="direct-deliver" value="false"/> </netty-acceptor>
The setup it's perfectly working if the SSL part is not enabled. Once I enable the SSL in the netty-connector and acceptor I get:
12:19:36,098 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (Camel (camelContext) thread #2 - JmsConsumer[notifyEmailProcessingQueue]) IJ000604: Throwable while attempting to get a new connection: null: javax.resource. ResourceException: Error during setup at org.hornetq.ra.HornetQRAManagedConnection.<init>(HornetQRAManagedConnection.java:151) at org.hornetq.ra.HornetQRAManagedConnectionFactory.createManagedConnection(HornetQRAManagedConnectionFactory.java:164) at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener(SemaphoreArrayListManagedConnectionPool.java:782) at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:345) at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:495) at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:374) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:329) at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368) at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464) at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:832) at org.hornetq.ra.HornetQRASessionFactoryImpl.createSession(HornetQRASessionFactoryImpl.java:465) at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$200(AbstractPollingMessageListenerContainer.java:77) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createSession(AbstractPollingMessageListenerContainer.java:531) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:300) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:288) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1096) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1088) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:985) [spring-jms-3.2.2.RELEASE.jar:3.2.2.RELEASE] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [rt.jar:1.6.0_41] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [rt.jar:1.6.0_41] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_41] Caused by: javax.resource.ResourceException: Failed to create session factory at org.hornetq.ra.HornetQRAManagedConnection.setup(HornetQRAManagedConnection.java:829) at org.hornetq.ra.HornetQRAManagedConnection.<init>(HornetQRAManagedConnection.java:140) ... 22 more Caused by: javax.jms.JMSException: Failed to create session factory at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:587) [hornetq-jms-client-2.3.0.CR1.jar:] at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:143) [hornetq-jms-client-2.3.0.CR1.jar:] at org.hornetq.ra.HornetQRAManagedConnection.setup(HornetQRAManagedConnection.java:813) ... 23 more Caused by: HornetQException[errorType=CONNECTION_TIMEDOUT message=HQ119032: Timed out waiting to receive cluster topology. Group:null] at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:884) [hornetq-core-client-2.3.0.CR1.jar:] at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:583) [hornetq-jms-client-2.3.0.CR1.jar:] ... 25 more
On the Instance B side (the hornetq server):
12:18:17,432 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42952. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:18:17,433 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42935. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:18:17,433 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42949. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:19:23,488 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42961. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:20:07,518 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42980. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:20:41,551 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42981. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:21:17,578 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42982. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:21:31,588 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42983. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT] 12:21:51,609 WARN [org.hornetq.core.client] (hornetq-failure-check-thread) HQ212107: Connection failure has been detected: HQ119034: Did not receive data from /10.20.103.62:42984. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT]
The application is using Spring + Camel.
Any help would be really appreciated.