5 Replies Latest reply on Nov 3, 2003 7:39 AM by sozonnik

    JMSContainerInvoker and ExceptionListenerImpl

    sozonnik

      Hello guys !

      First I had 2 JBoss's 3.2.1 on different machines. One server had queue and another server had MDB connected to remote queue. I'v used OIL2.
      Than firewall appears between servers, in such way, that only server with MDB can create network connections to other server and only to limited number of ports, but not otherwise.
      So I had replace JNDI initial context factory to org.jboss.naming.HttpNamingContextFactory , JNDI lookups works perfectly, but MDB unable to bind to qeuue. After some investigations I found that JBossMQProvider hard coded with org.jnp.interfaces.NamingContextFactory. I changed source code and bring out it as parameter to jboss-service.xml and set it to org.jboss.naming.HttpNamingContextFactory. After that everething begin to work.

      First my question is: I think that it is non standart way, but I was unable to make RMI works over my network condition. What is the standart way ?

      Then I begin to test reconnection in case of some failures. And I discovered that in reconnect loop of
      ExceptionListenerImpl when it try co create service org.jboss.naming.HttpNamingContextFactory throws IOException, loop goes to another turn an then Thread.sleep(reconnectInterval); throw InterruptedException and onException method exits, so connection will newer reconnected ! I saw to my old confifuration with simple RMI when connection losts reconnect loop FINISHED NORMALLY !!
      I have JMSContainerInvoker revision 1.50.2.6

      So

      invoker.innerStop();
      invoker.destroyService();
      invoker.startService();

      brings to:

      12:38:55,138 INFO [JMSContainerInvoker] Trying to reconnect to JMS provider
      12:39:05,148 ERROR [JMSContainerInvoker] Could not stop JMS connection
      12:39:05,151 INFO [DLQHandler] Stopping
      12:39:05,156 ERROR [DLQHandler] Stopping failed
      org.jboss.mq.SpyJMSException: Cannot disable the connection with the JMS server; -
      12:39:05,161 INFO [DLQHandler] Destroying
      12:39:05,165 ERROR [DLQHandler] Destroying failed
      org.jboss.mq.SpyJMSException: Cannot close properly the connection; -
      12:39:05,169 INFO [DLQHandler] Destroyed
      12:39:05,173 ERROR [JMSContainerInvoker] Failed to close connection consumer
      12:39:05,201 ERROR [JMSContainerInvoker] Failed to close connection
      12:39:05,209 INFO [DLQHandler] Creating
      12:39:05,373 ERROR [DLQHandler] Initialization failed
      12:39:05,377 INFO [JMSContainerInvoker] Reconnected to JMS provider <----- HOW CAN IT BE ?
      12:39:05,380 WARN [JMSContainerInvoker] JMS provider failure detected: <---- onException called again

      But this is not the biggest problem. If I remove return when InterruptedException thrown it work well ! BUT ! Loop works with high speed without sleepeng, and id is very bad.

      So my second question: Who calls Thread.interrupt(); and make reconnect thread to exit ?

        • 1. Re: JMSContainerInvoker and ExceptionListenerImpl

          Can you try it with 3.2.2

          I altered the exception listener because there was a memory leak
          in it. It now fully brings the JMS connection.

          Changing the JBossMQProvider is the current way to
          alter the jndi access (as I've said before I don't think it
          is a good mechanism because you have to write a
          class rather than just doing configuration).

          Regards,
          Adrian

          • 2. Re: JMSContainerInvoker and ExceptionListenerImpl
            sozonnik

            > Can you try it with 3.2.2
            >
            > I altered the exception listener because there was a
            > memory leak
            > in it. It now fully brings the JMS connection.

            I tryed 3.2.2, but nothing happend. ExceptionListener doesn't get up connection. Someone interrupts ExceptionListener ant it returns from loop. I attach my log, please see it.


            • 3. Re: JMSContainerInvoker and ExceptionListenerImpl

              I see OIL2 not being able to make a connection.
              Can you make an OIL2 connection between the machines,
              I would doubt it since OIL2 makes a connection back
              from JMS server to the client.
              Have you tried the HTTPXAConnectionFactory version?

              When it tries to reconnect, it gets a connection refused
              trying to connect to the web server.
              Are you sure your jndi config is correct?
              Can you connect to the webserver?


              Regards,
              Adrian

              • 4. Re: JMSContainerInvoker and ExceptionListenerImpl
                sozonnik

                > I see OIL2 not being able to make a connection.

                It is ok. Connection was established, and than I shutdown remote server to see that reconnect works. ExceptionListener onException tryes to reconnect one time, and on second time it exits from onEception by InterruptedException.

                > Have you tried the HTTPXAConnectionFactory version?

                Not yet. Can I replace HTTPConnectionFactory with it ?

                • 5. Re: JMSContainerInvoker and ExceptionListenerImpl
                  sozonnik

                  I understand what happend. I think this is JBoss bug.

                  After connection broken, ExceptionListener trys to reconnect and call invoker.innerStop();
                  this is lead to OIL2SocketHandler.stop();
                  in which worker.interrupt(); called - so thread interrupted and ExceptionListener
                  unable to continue.
                  This is stack trace before worker.interrupt(); in OIL2SocketHandler called:

                  Thread [OIL2 Worker-0] (Suspended (breakpoint at line 510 in OIL2SocketHandler))
                  OIL2SocketHandler.stop() line: 510
                  OIL2ServerIL.close() line: 582
                  OIL2ServerIL.connectionClosing(ConnectionToken) line: 410
                  SpyXAConnection(Connection).close() line: 491
                  JMSContainerInvoker.innerStop() line: 783
                  JMSContainerInvoker$ExceptionListenerImpl.onException(JMSException) line: 1171
                  SpyXAConnection(Connection).asynchFailure(String, Exception) line: 726
                  OIL2ClientILService.handleConnectionException(Exception) line: 82
                  OIL2SocketHandler.run() line: 484
                  Thread.run() line: 536 [local variables unavailable]

                  Can someone give me advice what should I do with it ?