Failed to lookup JMS destination with ConnectException: Connection refused, then NameNotFoundException: queue/exampleQueue in JBoss EAP 5

Solution Verified - Updated -

Issue

  • Fail to lookup JMS queue in JBoss EAP and seeing the exception below:
javax.naming.CommunicationException [Root exception is java.rmi.RemoteException: Service unavailable.; nested exception is:
  java.rmi.ConnectException: Connection refused to host: example-host1; nested exception is:
  java.net.ConnectException: Connection refused]
  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:886)
  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
  at javax.naming.InitialContext.lookup(InitialContext.java:411)
  at com.jboss.examples.services.ExampleJMSService.initJMS(MediatorService.java:824)
  ...
Caused by: java.rmi.RemoteException: Service unavailable.; nested exception is:
  java.rmi.ConnectException: Connection refused to host: example-host1; nested exception is:
  java.net.ConnectException: Connection refused
  at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:267)
  at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:327)
  at $Proxy240.lookup(Unknown Source)
  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:753)
  ... 7 more
Caused by: java.rmi.ConnectException: Connection refused to host: example-host1; nested exception is:
  java.net.ConnectException: Connection refused
  at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
  at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
  at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:128)
  at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
  at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:225)
  ... 10 more
Caused by: java.net.ConnectException: Connection refused
  at java.net.PlainSocketImpl.socketConnect(Native Method)
  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
  at java.net.Socket.connect(Socket.java:579)
  at java.net.Socket.connect(Socket.java:528)
  at java.net.Socket.<init>(Socket.java:425)
  at java.net.Socket.<init>(Socket.java:208)
  at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
  at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
  at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
  ... 15 more
...
javax.naming.NameNotFoundException: queue/exampleQueue
  at org.jboss.ha.jndi.HAJNDI.lookupRemotely(HAJNDI.java:354)
  at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:260)
  at sun.reflect.GeneratedMethodAccessor449.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at org.jboss.ha.framework.server.HARMIServerImpl.invoke(HARMIServerImpl.java:236)
  at sun.reflect.GeneratedMethodAccessor447.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:601)
  at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
  at sun.rmi.transport.Transport$1.run(Transport.java:177)
  at sun.rmi.transport.Transport$1.run(Transport.java:174)
  at java.security.AccessController.doPrivileged(Native Method)
  at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
  at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
  at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
  at java.lang.Thread.run(Thread.java:722)
  at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
  at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
  at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:160)
  at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
  at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:225)
  at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:327)
  at $Proxy240.lookup(Unknown Source)
  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:753)
  at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:713)
  at javax.naming.InitialContext.lookup(InitialContext.java:411)
  at com.jboss.examples.services.ExampleJMSService.initJMS(MediatorService.java:824)
  at com.jboss.examples.services.ExampleJMSService.access$100(MediatorService.java:67)
  at com.jboss.examples.services.ExampleJMSService$ExceptionListenerImpl.onException(MediatorService.java:927)
  at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:130)
  at org.jboss.remoting.ConnectionValidator$3.run(ConnectionValidator.java:524)

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.