0 Replies Latest reply on Jun 30, 2006 3:51 AM by Ales Justin

    MDPOJOs state type question + ExceptionListener on Producer?

    Ales Justin Master

      Using JBossAS 4.0.4GA and EJB3 RC8 FD.

      1.

      public static void main(String[] args) throws Exception
      {
      InitialContext ctx = new InitialContext();
      QueueTestRemote tester =
      (QueueTestRemote)ctx.lookup(QueueTestRemote.class.getName());
      
      ProducerObject po = (ProducerObject)tester;
      ProducerManager manager = po.getProducerManager();
      
      manager.connect(); // internally create a JMS connection
      try
      {
      tester.method1("hello world", 55);
      }
      finally
      {
      manager.close(); // clean up the JMS connection
      }
      }
      


      Are we invoking same server 'tester' instance?
      - ProducerManager manager = ((ProducerObject)tester).getProducerManager();
      - tester.method1("hello world", 55);

      Calling two different methods?
      It must be stateful, since if it would be like stateless sesion bean -
      you are not guaranteed to get the same server instance twice. And we would could actually be opening and closing totally different manager instance from the one that the second tester invocation (tester.method1(...)) is referencing.
      Or am I wrong?

      2.

      Should I connect and close on every Producer method invocation - no need then for ExceptionListener?
      Or is there a way to set ExceptionListener on connection (producer) if I only connect at app startup and close on undeploy / destroy.

      Since I have this strange problem - for no particular reason system time on our Linux machine jumps more than 60s in the future (no idea why) - and my JMS collapses:

      2006-06-14 19:10:06,263 WARN [org.jboss.mq.Connection] Connection failure, use javax.jms.Connection.setExceptionListener() to handle this error and reconnect
      org.jboss.mq.SpyJMSException: Cannot ping the JMS server; - nested throwable: (java.io.IOException: Client is not connected)
      at org.jboss.mq.SpyJMSException.getAsJMSException(SpyJMSException.java:78)
      at org.jboss.mq.SpyJMSException.rethrowAsJMSException(SpyJMSException.java:63)
      at org.jboss.mq.Connection.pingServer(Connection.java:846)
      at org.jboss.mq.Connection$PingTask.run(Connection.java:1281)
      at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(ClockDaemon.java:364)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.io.IOException: Client is not connected
      at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:265)
      at org.jboss.mq.il.uil2.SocketManager.sendReply(SocketManager.java:239)
      at org.jboss.mq.il.uil2.UILServerIL.ping(UILServerIL.java:488)
      at org.jboss.mq.Connection.pingServer(Connection.java:842)
      ... 3 more
      2006-06-14 19:11:06,267 WARN [org.jboss.mq.Connection] Connection failure, use javax.jms.Connection.setExceptionListener() to handle this error and reconnect
      org.jboss.mq.SpyJMSException: No pong received; - nested throwable: (java.io.IOException: ping timeout.)
      at org.jboss.mq.Connection$PingTask.run(Connection.java:1277)
      at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(ClockDaemon.java:364)
      at java.lang.Thread.run(Thread.java:595)
      Caused by: java.io.IOException: ping timeout.
      ... 3 more
      (and so on and on ....)
      


      Rgds, Ales