0 Replies Latest reply on Feb 13, 2002 2:13 PM by Eduard

    Log4j & JBossMQ

    Eduard Newbie

      Hi everybody,
      I am trying to get log4j append messages to the JMS Topic on JBoss 2.2.2 ( running on Linux RH6.2 + JDK 1.3.1 ).

      I am able to publish LoggingEvent object on the client and receive it on the JBoss.
      What I am not able to do is to get rendered message.
      If I am using Container managed transaction the JBossMQ service goes to neverending loop. In case with Bean managed transaction I am able to get the following stack trace:

      [Container factory] Exception in JMSCI message listener: : java.rmi.ServerException: Transaction rolled back:null
      [Container factory] java.rmi.ServerException: Transaction rolled back:null
      [Container factory] at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:122)
      [Container factory] at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:58)
      [Container factory] at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:190)
      [Container factory] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
      [Container factory] at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:264)
      [Container factory] at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:151)
      [Container factory] at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:448)
      [Container factory] at org.jbossmq.SpyMessageConsumer.deliverMessage(SpyMessageConsumer.java:294)
      [Container factory] at org.jbossmq.SpySession.run(SpySession.java:236)
      [Container factory] at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:131)
      [Container factory] at org.jboss.jms.asf.ThreadPool$Worker.run(ThreadPool.java:128)


      Here is a chunk of code which produce the above message:
      ...
      public void onMessage(Message _msg) {
      try {
      Object msg = ( ( ObjectMessage )_msg ).getObject();
      if( msg instanceof LoggingEvent ) {
      try {
      String message = ( ( LoggingEvent )msg ).getRenderedMessage() );
      } catch( Exception e ) {
      e.printStackTrace();
      }
      } else {
      System.err.println( "Message is of unknown type " );
      }
      } catch( Exception e ) {
      System.out.println( "Failed to get the message: " + e.getMessage() );
      }
      }
      ...

      If somebody have solved similar problem pls let me know.

      Thanks in advance.

      Ed.