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.