Trying to reconnect to JMS provider

I was getting the following exceptions for my one application deployed on JBoss.

11:25:15,204 INFO  [JMSContainerInvoker] Trying to reconnect to JMS provider for AsynchronousMessageRouter
11:25:15,214 ERROR [JMSContainerInvoker] Reconnect failed: JMS provider failure detected for AsynchronousMessageRouter
javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:1099 and discovery failed with error: javax.naming.CommunicationException: Failed to retrieve stub from server 192.168.0.87:1100 [Root exception is java.io.StreamCorruptedException: unexpected block data] [Root exception is javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]]
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1416)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:596)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:192)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
        at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:188)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:665)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl$ExceptionListenerRunnable.run(JMSContainerInvoker.java:1594)
        at java.lang.Thread.run(Thread.java:619)
Caused by: javax.naming.CommunicationException: Failed to connect to server 127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1387)
        ... 9 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server 127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:243)
        ... 10 more
Caused by: java.net.ConnectException: Connection refused
        at java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
        at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
        at java.net.Socket.connect(Socket.java:519)
        at java.net.Socket.connect(Socket.java:469)
        at java.net.Socket.<init>(Socket.java:366)
        at java.net.Socket.<init>(Socket.java:267)
        at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
        at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:239)
        ... 10 more
11:25:15,214 INFO  [JMSContainerInvoker] Waiting for reconnect internal 10000ms for AsynchronousMessageRouter

and

11:16:44,031 INFO  [JMSContainerInvoker] Waiting for reconnect internal 10000ms for AsynchronousMessageRouter
11:16:54,033 INFO  [JMSContainerInvoker] Trying to reconnect to JMS provider for AsynchronousMessageRouter
11:16:54,034 ERROR [JMSContainerInvoker] Reconnect failed: JMS provider failure detected for AsynchronousMessageRouter
javax.naming.NameNotFoundException: XAConnectionFactory not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at org.jboss.ejb.plugins.jms.DLQHandler.createService(DLQHandler.java:182)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:260)
        at org.jboss.system.ServiceMBeanSupport.create(ServiceMBeanSupport.java:188)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker.innerStartDelivery(JMSContainerInvoker.java:665)
        at org.jboss.ejb.plugins.jms.JMSContainerInvoker$ExceptionListenerImpl$ExceptionListenerRunnable.run(JMSContainerInvoker.java:1594)
        at java.lang.Thread.run(Thread.java:619)

I was starting the jboss by binding it with some IP e.g. 192.168.0.37 by using command ./run.sh -c messaging -b 192.168.0.37 -u username -p password.

But in the jndi.properties, I had mentioned java.naming.provider.url=127.0.0.1:1099.

Solution:
To solve this problem, either change the IP in jndi.properties to 192.168.0.37 or I should use 0.0.0.0 IP to bind when starting JBoss so that JBoss would bind to all available IPs including 127.0.0.1.

But if binding with 0.0.0.0 creates problem, use the same IP in start-up binding and in the jndi.properties file.

About these ads

1 Comment

Filed under Errors/Exceptions, Java / Java EE, JBoss

One Response to Trying to reconnect to JMS provider

  1. rafeeq

    Thanks this helped me solve a pblm that was nagging me for 3 months

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s