2 Replies Latest reply: Aug 27, 2011 9:55 AM by Ruslan Danilin RSS

    javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:7099

    Ruslan Danilin Newbie

      Hello,

       

      I'm trying to run standalone java application that subscribes to JMS topic on JBoss AS 7.0.1 but get an error.

      The same app works fine on JBoss AS 6.1. I'm running JBoss with full profile  (./standalone.sh --server-config=standalone-preview.xml)

      Connection properties looks like this:

       

      INITIAL_CONTEXT_FACTORY=org.jnp.interfaces.NamingContextFactory

      URL_PKG_PREFIXES=org.jboss.naming:org.jnp.interfaces

      PROVIDER_URL=jnp://127.0.0.1:1099

       

      When I'm starting my app I get this exception:

       

      Exception in thread "main" javax.naming.CommunicationException: Could not obtain connection to any of these urls: 127.0.0.1:7099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]

                at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1690)

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1761)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

                at javax.naming.InitialContext.lookup(InitialContext.java:409)

                at net.delmax.JMSClient.example(JMSClient.java:26)

                at net.delmax.JMSClient.main(JMSClient.java:114)

      Caused by: java.net.SocketTimeoutException: Receive timed out

                at java.net.PlainDatagramSocketImpl.receive0(Native Method)

                at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:135)

                at java.net.DatagramSocket.receive(DatagramSocket.java:729)

                at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1659)

                ... 6 more

      [Root exception is javax.naming.CommunicationException: Failed to connect to server /127.0.0.1:7099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:7099 [Root exception is java.net.ConnectException: Connection refused]]]

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1780)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:695)

                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)

                at javax.naming.InitialContext.lookup(InitialContext.java:409)

                at net.delmax.JMSClient.example(JMSClient.java:26)

                at net.delmax.JMSClient.main(JMSClient.java:114)

      Caused by: javax.naming.CommunicationException: Failed to connect to server /127.0.0.1:7099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:7099 [Root exception is java.net.ConnectException: Connection refused]]

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:337)

                at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1746)

                ... 5 more

      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server /127.0.0.1:7099 [Root exception is java.net.ConnectException: Connection refused]

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:307)

                ... 6 more

      Caused by: java.net.ConnectException: Connection refused

                at java.net.PlainSocketImpl.socketConnect(Native Method)

                at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)

                at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)

                at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)

                at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)

                at java.net.Socket.connect(Socket.java:546)

                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:97)

                at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)

                at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:303)

                ... 6 more

       

       

      why this happens and how can I fix it?