Zahid Saleem
2013-06-24 16:39:51 UTC
Zahid Saleem [https://community.jboss.org/people/zeebot] created the discussion
"SSL Enabled HornetQ Connector wont connect."
To view the discussion, visit: https://community.jboss.org/message/824600#824600
--------------------------------------------------------------
All i am currently struggling to connect to SSL enabled JMS Queue using HornetQConnectionFactory in JBoss 6.1.0-Final
My Server is basically running the ssl-enabled hornetQ configuration and using the keys provided - the server loads up successfully and the listening on port 5500
The Client is a pragmatic HornetQ Connector that should hopefully connect to the Server the following code illustrates how i create the connection
      Â
      Â
       Map<String, Object> connParams = new HashMap<String, Object>();
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, port);
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, host);
Â
Â
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.SSL_ENABLED_PROP_NAME, true);
       connParams.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "hornetqexample");
       connParams.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "/opt/cert/hornetq.example.keystore");
Â
Â
       TransportConfiguration transConfig =
               new TransportConfiguration(NettyConnectorFactory.class.getName(), connParams);
Â
Â
       hcf = new HornetQJMSConnectionFactory(false, transConfig);
Â
       try {
           Queue queue;
Â
           queue = new HornetQQueue(queueName);
           if (username != null && password != null) {
Â
               connection = hcf.createConnection(username, password);
Â
           } else {
               connection = hcf.createConnection();
           }
Â
Â
           session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
           producer = session.createProducer(queue);
           connection.start();
           connected = true;
Â
       } catch (JMSException ex) {
           // Throw an exception that can be handled by the caller
          Â
           logger.error("Problem creating JMS connection", es);
           // Disconnect so that we clean up any partially created components
           disconnect();
Â
           throw commsEx;
       }
Â
The above works when SSL is disabled - however when it SSL is enabled the server side errors with
Â
17:07:41,024 INFOÂ [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.1.0.Final "Neo"] Started in 35s:923ms
17:12:51,067 ERROR [org.jboss.xnio.channel-listener] A channel event listener threw an exception: java.lang.IllegalArgumentException
       at java.nio.ByteBuffer.allocate(ByteBuffer.java:311) [:1.6.0_45]
       at org.jboss.xnio.channels.MessageStreamChannelListener.handleEvent(org.jboss.xnio.channels.MessageStreamChannelListener:108)
       at org.jboss.xnio.channels.MessageStreamChannelListener.handleEvent(org.jboss.xnio.channels.MessageStreamChannelListener:1) [
       at org.jboss.xnio.IoUtils.invokeChannelListener(org.jboss.xnio.IoUtils:536) [:6.1.0.Final]
       at org.jboss.xnio.nio.NioTcpChannel$ReadHandler.run(NioTcpChannel.java:389) [:6.1.0.Final]
       at org.jboss.xnio.IoUtils$2.execute(org.jboss.xnio.IoUtils:71) [:6.1.0.Final]
       at org.jboss.xnio.nio.NioSelectorRunnable.run(NioSelectorRunnable.java:115) [:6.1.0.Final]
       at java.lang.Thread.run(Thread.java:662) [:1.6.0_45]
       at org.jboss.threads.JBossThread.run(JBossThread.java:122) [:2.0.0.CR7]
Â
Â
LIke i mentioned the Server side hornetQ config is almost identicle to the ssl-enabled example available in hornetQ.
There are Netty SSL Conenctors and Acceptors are configured in the hornetq-configuration.xml the exampleQueue is created on the server side. So am unsure why i cant connect
successfully from the client. However the example does use JNDI lookup where as I am create a HornetQConnector to connect over SSL i wouldnt have thought that will be an issue.
Â
Any help on the above would be greatly appreciated.
Â
Â
Â
Â
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/824600#824600]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]
"SSL Enabled HornetQ Connector wont connect."
To view the discussion, visit: https://community.jboss.org/message/824600#824600
--------------------------------------------------------------
All i am currently struggling to connect to SSL enabled JMS Queue using HornetQConnectionFactory in JBoss 6.1.0-Final
My Server is basically running the ssl-enabled hornetQ configuration and using the keys provided - the server loads up successfully and the listening on port 5500
The Client is a pragmatic HornetQ Connector that should hopefully connect to the Server the following code illustrates how i create the connection
      Â
      Â
       Map<String, Object> connParams = new HashMap<String, Object>();
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, port);
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.HOST_PROP_NAME, host);
Â
Â
       connParams.put(org.hornetq.core.remoting.impl.netty.TransportConstants.SSL_ENABLED_PROP_NAME, true);
       connParams.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "hornetqexample");
       connParams.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "/opt/cert/hornetq.example.keystore");
Â
Â
       TransportConfiguration transConfig =
               new TransportConfiguration(NettyConnectorFactory.class.getName(), connParams);
Â
Â
       hcf = new HornetQJMSConnectionFactory(false, transConfig);
Â
       try {
           Queue queue;
Â
           queue = new HornetQQueue(queueName);
           if (username != null && password != null) {
Â
               connection = hcf.createConnection(username, password);
Â
           } else {
               connection = hcf.createConnection();
           }
Â
Â
           session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
           producer = session.createProducer(queue);
           connection.start();
           connected = true;
Â
       } catch (JMSException ex) {
           // Throw an exception that can be handled by the caller
          Â
           logger.error("Problem creating JMS connection", es);
           // Disconnect so that we clean up any partially created components
           disconnect();
Â
           throw commsEx;
       }
Â
The above works when SSL is disabled - however when it SSL is enabled the server side errors with
Â
17:07:41,024 INFOÂ [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.1.0.Final "Neo"] Started in 35s:923ms
17:12:51,067 ERROR [org.jboss.xnio.channel-listener] A channel event listener threw an exception: java.lang.IllegalArgumentException
       at java.nio.ByteBuffer.allocate(ByteBuffer.java:311) [:1.6.0_45]
       at org.jboss.xnio.channels.MessageStreamChannelListener.handleEvent(org.jboss.xnio.channels.MessageStreamChannelListener:108)
       at org.jboss.xnio.channels.MessageStreamChannelListener.handleEvent(org.jboss.xnio.channels.MessageStreamChannelListener:1) [
       at org.jboss.xnio.IoUtils.invokeChannelListener(org.jboss.xnio.IoUtils:536) [:6.1.0.Final]
       at org.jboss.xnio.nio.NioTcpChannel$ReadHandler.run(NioTcpChannel.java:389) [:6.1.0.Final]
       at org.jboss.xnio.IoUtils$2.execute(org.jboss.xnio.IoUtils:71) [:6.1.0.Final]
       at org.jboss.xnio.nio.NioSelectorRunnable.run(NioSelectorRunnable.java:115) [:6.1.0.Final]
       at java.lang.Thread.run(Thread.java:662) [:1.6.0_45]
       at org.jboss.threads.JBossThread.run(JBossThread.java:122) [:2.0.0.CR7]
Â
Â
LIke i mentioned the Server side hornetQ config is almost identicle to the ssl-enabled example available in hornetQ.
There are Netty SSL Conenctors and Acceptors are configured in the hornetq-configuration.xml the exampleQueue is created on the server side. So am unsure why i cant connect
successfully from the client. However the example does use JNDI lookup where as I am create a HornetQConnector to connect over SSL i wouldnt have thought that will be an issue.
Â
Any help on the above would be greatly appreciated.
Â
Â
Â
Â
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/824600#824600]
Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]