2 Replies Latest reply on Aug 27, 2009 3:50 PM by Karthik Ramachandran

    MDBs and -b option.

    Karthik Ramachandran Newbie

      Hi,

      I'm having trouble deploying an mdb. It's a relatively simply EJB 3, MDB configured via annotations.

      Here is the config:

      @MessageDriven(activationConfig = {
       @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
       @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
       @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/DeliverMPOExternalMessageQueue"),
       // @ActivationConfigProperty(propertyName = "providerAdapterJNDI", propertyValue = "java:/RemoteJMSProvider"),
       @ActivationConfigProperty(propertyName = "user", propertyValue = "user"),
       @ActivationConfigProperty(propertyName = "password", propertyValue = "password")
      })
      


      This works fine when i simply start a server using ./run.sh. However when i bind the server to my ip address: ./run.sh -b 10.0.0.191 . I get the following errors:

      14:12:48,538 DEBUG [NamingContext] Failed to connect to localhost:1099
      javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:331)
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1696)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:689)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jboss.util.naming.Util.lookup(Util.java:222)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setupDLQDestination(AbstractDLQHandler.java:106)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setup(AbstractDLQHandler.java:82)
       at org.jboss.resource.adapter.jms.inflow.dlq.JBossMQDLQHandler.setup(JBossMQDLQHandler.java:48)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDLQ(JmsActivation.java:413)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:351)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:292)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:733)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
       at java.lang.Thread.run(Thread.java:613)
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301)
       ... 17 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:432)
       at java.net.Socket.connect(Socket.java:520)
       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:297)
       ... 17 more
      14:12:53,540 ERROR [JmsActivation] Unable to reconnect org.jboss.resource.adapter.jms.inflow.JmsActivationSpec@74b6e6(ra=org.jboss.resource.adapter.jms.JmsResourceAdapter@2a032a destination=queue/DeliverMPOExternalMessageQueue destinationType=javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/DefaultJMSProvider user=bssub pass=<not shown> maxMessages=1 minSession=1 maxSession=15 keepAlive=60000 useDLQ=true DLQHandler=org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJndiName=queue/DLQ DLQUser=null DLQMaxResent=5)
      javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]]
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1725)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:689)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:682)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jboss.util.naming.Util.lookup(Util.java:222)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setupDLQDestination(AbstractDLQHandler.java:106)
       at org.jboss.resource.adapter.jms.inflow.dlq.AbstractDLQHandler.setup(AbstractDLQHandler.java:82)
       at org.jboss.resource.adapter.jms.inflow.dlq.JBossMQDLQHandler.setup(JBossMQDLQHandler.java:48)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupDLQ(JmsActivation.java:413)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:351)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation.handleFailure(JmsActivation.java:292)
       at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:733)
       at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:213)
       at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:260)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
       at java.lang.Thread.run(Thread.java:613)
      Caused by: javax.naming.CommunicationException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:331)
       at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1696)
       ... 16 more
      Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost/127.0.0.1:1099 [Root exception is java.net.ConnectException: Connection refused]
       at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:301)
       ... 17 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:432)
       at java.net.Socket.connect(Socket.java:520)
       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:297)
       ... 17 more
      


      Any hints?

        • 1. Re: MDBs and -b option.
          Peter Johnson Master

          The problem is that the lookup for the queue is done using localhost, but the app server is not binding to locahost - instead it is binding to the host mentioned with the -b option.

          One possible solution is to bind to 0.0.0.0 (-b 0.0.0.0), then the app server will bind to your IP address and localhost (and any other IP address defined on your system).

          A second possible solution, which I have not verified but should work, is to add the following line to the server/xxx/conf/jndi.properties file (replace 99.99.99.99 with your IP address):

          java.naming.provider.url=jnp://99.99.99.99:1099

          • 2. Re: MDBs and -b option.
            Karthik Ramachandran Newbie

            So it turned out the problem was there was a jndi.properties in my classpath. Which set localhost.