5 Replies Latest reply on Feb 4, 2009 8:38 AM by senthil kumar

    can not catch excption when jboss as is down

    Tony Lu Newbie

      Application environment: JBoss Application Server 4.2.1, JBoss Messaging 1.3.0

      THere is a standalone application to receive jms in a while loop

      When Jboss server is up, the application runs well.
      But When I shutdown the JBoss server and restart it, the application can not run

      Part of the code: I want to re-connect JBoss Message when JBoss is down
      But it seems the application willl never go to #10 even JBoss is shut down.

      boolean reConnect = false;
      #1 while (true){
      #2 try{
      #3 if(reConnect){ // Try to connect JBoss Connection again
      #4 sf = new ServiceFactory(ic,"/ConnectionFactory");
      #5 reConnect = false;
      #6 }
      #7 String message = receiver.receive(1000);
      #8 }catch(Exception e){
      #9 // No exception is catched
      #10 System.out.println("exception");
      #11 reConnect = true;
      #12 }
      #13}


      ow can I make the application running when jboss is restarted?

      Some log information is detected:


      2007-10-26 17:34:52,633 ERROR [org.jboss.remoting.transport.bisocket.BisocketServerInvoker] unable to get secondary locator
      org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:530)
       at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.transport(BisocketClientInvoker.java:353)
       at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
       at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.getSecondaryLocator(BisocketClientInvoker.java:441)
       at org.jboss.remoting.transport.bisocket.BisocketServerInvoker.createControlConnection(BisocketServerInvoker.java:204)
       at org.jboss.remoting.transport.bisocket.BisocketServerInvoker$1.run(BisocketServerInvoker.java:949)
      Caused by: java.net.ConnectException: Connection refused: connect
       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:364)
       at java.net.Socket.connect(Socket.java:507)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187)
       at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.createSocket(BisocketClientInvoker.java:360)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:801)
       at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:526)
       ... 5 more
      2007-10-26 17:34:52,633 ERROR [org.jboss.remoting.transport.bisocket.BisocketServerInvoker] Unable to recreate control connection: InvokerLocator [null://192.168.164.172:3892/null]
      java.io.IOException: unable to get secondary locator: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
       at org.jboss.remoting.transport.bisocket.BisocketServerInvoker.createControlConnection(BisocketServerInvoker.java:209)
       at org.jboss.remoting.transport.bisocket.BisocketServerInvoker$1.run(BisocketServerInvoker.java:949)
      2007-10-26 17:34:58,551 WARN [org.jboss.remoting.LeasePinger] LeasePinger[SocketClientInvoker[12789d2, bisocket://192.168.164.172:4457](5c4o4k4s-3b4bn5-f88ic34s-1-f88ic3ta-5)] failed to ping to server: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://192.168.164.172:4457/?clientMaxPoolSize=50&clientSocketClass=org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&numberOfRetries=1&socket.check_connection=false&timeout=0&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]



      Please help, thanks in advance

        • 1. Re: can not catch excption when jboss as is down
          Neeraj khadakkar Newbie

          JBoss AS 4.2.1/JBM 1.3 GA/ Spring 2.x

          I am running into a similar issue(i think).
          My application has a listener on a remote client (coded as per jboss doc) connected to the JMS provider (jboss 4.2.x/jbm 1.3). Everything works fine as long as certain
          sequence of operations is maintained. Specifically if the JBoss server is shutdown and restarted, i see the following errors in the LIstener logs :

          13:35:16,396 DEBUG [Timer-0]: org.jboss.remoting.LeasePinger - LeasePinger[SocketClientInvoker[57e787, bisocket://127.0.0.1:4458](3j001-8mwhow-f893r9kl-1-f893r9yr-5)] failed to ping to server
          org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://127.0.0.1:4458/?clientMaxPoolSize=50&clientSocketClass=\
          org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&\
          marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&\
          numberOfRetries=1&socket.check_connection=false&timeout=10000&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
           at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:530)
           at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.transport(BisocketClientInvoker.java:353)
           at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
           at org.jboss.remoting.LeasePinger.sendClientPing(LeasePinger.java:283)
           at org.jboss.remoting.LeasePinger.access$000(LeasePinger.java:20)
           at org.jboss.remoting.LeasePinger$LeaseTimerTask.run(LeasePinger.java:315)
           at java.util.TimerThread.mainLoop(Timer.java:512)
           at java.util.TimerThread.run(Timer.java:462)
          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 org.jboss.remoting.transport.socket.SocketClientInvoker.createSocket(SocketClientInvoker.java:187)
           at org.jboss.remoting.transport.bisocket.BisocketClientInvoker.createSocket(BisocketClientInvoker.java:360)
           at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.getConnection(MicroSocketClientInvoker.java:801)
           at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:526)
           ... 7 more
          13:35:16,397 WARN [Timer-0]: org.jboss.remoting.LeasePinger - LeasePinger[SocketClientInvoker[57e787, bisocket://127.0.0.1:4458](3j001-8mwhow-f893r9kl-1-f893r9yr-5)] failed to ping to server: Can not get connection to server. Problem establishing socket connection for InvokerLocator [bisocket://127.0.0.1:4458/?clientMaxPoolSize=50&clientSocketClass=\
          org.jboss.jms.client.remoting.ClientSocketWrapper&dataType=jms&\
          marshaller=org.jboss.jms.wireformat.JMSWireFormat&numberOfCallRetries=1&\
          numberOfRetries=1&socket.check_connection=false&timeout=10000&unmarshaller=org.jboss.jms.wireformat.JMSWireFormat]
          13:35:17,171 DEBUG [URIListener-2]: org.springframework.jms.listener.DefaultMessageListenerContainer - Consumer [JBossMessageConsumer->ConsumerDelegate[28384121, ID=73]] of session [JBossSession->SessionDelegate[8574467, ID=71]] did not receive a message
          13:35:17,184 DEBUG [URIListener-1]: org.springframework.jms.listener.DefaultMessageListenerContainer - Consumer


          Now if the JBoss AS comes up again, the JBoss Remoting client code appears to connect
          successfully to JBM. Only issue is since the above stack trace is never bubbled up to my Listener code, my listener continues to be registered to a legacy provider.. and as a result never gets any new messages.

          This issue is solvable(with a hack) IF i stop pooling JMS consumers in my listener code and create new JMS Consumer for every recieve poll.


          • 2. Re: can not catch excption when jboss as is down
            Tim Fox Master

            This looks like a remoting bug that was fixed some time ago.

            You should try remoting and JBM.

            http://jira.jboss.com/jira/browse/JBREM-732

            • 3. Re: can not catch excption when jboss as is down
              Neeraj khadakkar Newbie

              I am using the version of JBoss Remoting as specified in the Jboss Messaging User guide. On looking at the contents of the JBoss Remoting jar, i see that it is the version : 2.2.1 GA.

              The issue JBREM-732 appears to be fixed as of 2.2.0SP1. I guess that means JBoss Remoting 2.2.1 GA contains that fix. JBREM-732 consists of 're-connect' issues after the server has bounced... whereas in my situation Jboss remoting re-connect works well with no exceptions being thrown.
              Its more of a issue that my JMS Listener never gets notification regarding the JMS Provider being unavailable....AND after the JMS provider becomes available, the Listener never gets any subsequent messages.
              I have tried registering JMS Exception Listeners and even these are not invoked.

              What is the maximum version of JBoss remoting that is compatible with JBoss AS 4.2.1 + Jboss Messaging 1.3.0 GA ? I could try a later version of remoting if i knew that it is compatible.

              • 4. Re: can not catch excption when jboss as is down
                Neeraj khadakkar Newbie

                update for anybody with similar issues :
                Updating to Messaging 1.4SP1 + remoting 2.2.2SP1 + JBoss AS 4.2.2GA has helped iron out a couple of nagging issues related to JMS provider boucing with Listeners attached.

                • 5. Re: can not catch excption when jboss as is down
                  senthil kumar Newbie

                  Hi,

                  I am also getting same problem with following environment.

                  jboss-4.2.3.GA-jdk6
                  jboss-messaging-1.4.0.SP3

                  Thanks,