Search code examples
javajbossjmshornetq

Connecting remote JBoss-eap-6.2 to pass message in java


Code runs without any problem up to creating connection factory but it cannot create topic connection. When creating topic connection it throws following exception.(My code is for creating publisher and subscriber) Here is the terminal output I received,

Jun 03, 2015 10:51:55 AM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.7.GA-redhat-1
Jun 03, 2015 10:51:55 AM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA-redhat-1
Jun 03, 2015 10:51:55 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.18.GA-redhat-1
connFactory : HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initial
Connectors=[TransportConfiguration(name=netty, factory=org-hornetq-core-remoting
-impl-netty-NettyConnectorFactory) ?host=172-26-75-72&port=5545], discoveryGroup
Configuration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSiz
e=1048576, readOnly=false]
JMSException
javax.jms.JMSException: Failed to create session factory
        at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInter
nal(HornetQConnectionFactory.java:587)
        at org.hornetq.jms.client.HornetQConnectionFactory.createTopicConnection
(HornetQConnectionFactory.java:131)
        at pubsub.Publisher.ConnectionSetup(Publisher.java:55)
        at pubsub.Publisher.sendMessage(Publisher.java:77)
        at pubsub.PubStart.main(PubStart.java:9)
Caused by: HornetQException[errorType=NOT_CONNECTED message=HQ119007: Cannot con
nect to server(s). Tried with all available servers.]
        at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(S
erverLocatorImpl.java:909)
        at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInter
nal(HornetQConnectionFactory.java:583)
        ... 4 more
Jun 03, 2015 10:51:57 AM org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1
$MessageReceiver handleEnd
ERROR: Channel end notification received, closing channel Channel ID 9ebab472 (o
utbound) of Remoting connection 01bb14d2 to /172.26.75.72:4547

Solution

  • Since I'm accessing this Jboss server through the VPN connection they only allow me to access 172.26.75.72:4547 only.The port is 4547 because of they were set an off set of 100 in standalone-full.xml file. After printing connection factory I saw it access another port for the communication since they doesn't allow that port to access my code throws above exception. Till you are working in a unrestricted network the above exception will not be thrown. After allowing port 4547 my code ran smoothly.