10 Replies Latest reply on Oct 5, 2007 10:13 AM by Adrian Brock

    Exception in JMSCI message listener

    Nicolas Daudin Newbie

      Hi there,
      I'm having a big problem with JMS queues.
      OK here is the context.
      Until this morning, i had an application running perfectly on JBoss3.2.3, under Java 4, with no webservices and JMS queue.
      I updated it on my production environment, adding a WebService feature to connect onto a distant WebService.
      I added the following librairies:
      - axis-1.4.jar
      - axis-jaxrpc-1.4.ar
      - axis-saaj-1.4.jar
      - axis-wsdl4j-1.5.1.jar
      - commons-discovery-0.2.jar

      When i restarted my JBoss server, the new feature was working perfectly and doing what i was expecting (connecting and sending datas over the network to a distant server). BUT, on the other side, everytime a message was being sent to or from my JMS queues, i was having this error message:

      12:44:10,810 ERROR [JMSContainerInvoker] Exception in JMSCI message listener
      javax.ejb.EJBException: RuntimeException; CausedByException is:
       null
       at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:357)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:374)
       at org.jboss.ejb.Container.invoke(Container.java:700)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:824)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1114)
       at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
       at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:633)
       at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:433)
       at org.jboss.mq.SpySession.run(SpySession.java:298)
       at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
       at java.lang.Thread.run(Thread.java:534)
      java.lang.NullPointerException
       at com.thalys.localys.frontal.MessageTrainCreator.marshall(Unknown Source)
       at com.thalys.localys.frontal.MessageTrain.sendToLocalysQueue(Unknown Source)
       at com.thalys.localys.bordmsg.receiving.BordMsgReceiverBean.onMessage(Unknown Source)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:460)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
       at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:144)
       at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)
       at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:62)
       at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:90)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:374)
       at org.jboss.ejb.Container.invoke(Container.java:700)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:824)
       at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1114)
       at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
       at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:633)
       at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:433)
       at org.jboss.mq.SpySession.run(SpySession.java:298)
       at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
       at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
       at java.lang.Thread.run(Thread.java:534)


      I'm really worried about this cause i really need to make it work. And if the JMs queues does not work anymore, i lose all the interest of my app.

      Hope you will be able to help me.



        • 1. Re: Exception in JMSCI message listener
          Nicolas Daudin Newbie

          Let me just explain briefly the context of my project. This application is communicating with another app via the WebService i'm talking about. My colleague is developing the other app and generated for me the client code to connect to the WebService, since he is hosting the WS. I don't know anything about WS, and he doesn't know anything about the app i'm developing, so i'm queit obliged to use Axis and he can't really help me.
          Thats why i hope there is an easy answer/solution to my problem, cause i'm not able to do anything with WebService.
          I know, i could try, but the point is, i just arrived on this app, and they NEVER put any test environment. So to try things out, i'm obliged to try them directly in production environment. So i don't really want to try new solutions (and creating a whole testing environment would oblige me to handle JMS queues, and my app is really to complex for this i guess... besides the messages received on JMS queues are sent by a distant module that i can't really simulate)
          Anyway, hope you will be able to help me...

          • 2. Re: Exception in JMSCI message listener
            Nicolas Daudin Newbie

            Just realized my problem could come from an API conflict.
            I checked my code of com.thalys.localys.frontal.MessageTrainCreator.marshall, and inside i use jaxb-api.jar...
            And one of the librairies i added was axis-jaxrpc-1.4. Could this be a problem and create my exception???

            Thank you in advance.

            • 3. Re: Exception in JMSCI message listener
              Nicolas Daudin Newbie

              So, no one has any clue?
              Tell me if you didn't understand anything... :)

              • 5. Re: Exception in JMSCI message listener
                Adrian Brock Master

                What is so difficult to undertand about this:

                java.lang.NullPointerException
                 at com.thalys.localys.frontal.MessageTrainCreator.marshall(Unknown Source)
                


                It's a bug in your code.

                • 6. Re: Exception in JMSCI message listener
                  Nicolas Daudin Newbie

                  Hey Adrian,

                  Sorry, yes i know the error is not exactly in my code.

                  But maybe you can still help me,
                  I checked my code of com.thalys.localys.frontal.MessageTrainCreator.marshall , and inside i use jaxb-api.jar ...
                  And one of the librairies i added in JBoss libs was axis-jaxrpc-1.4 . Could this be a problem and create my exception??? Could there be a library conflict.

                  Thank you in advance.
                  I guess this forum is not the place to solve my pb anymore, but we never know...

                  • 7. Re: Exception in JMSCI message listener
                    Adrian Brock Master

                     

                    "nicdo77" wrote:
                    Hey Adrian,

                    Sorry, yes i know the error is not exactly in my code.


                    It's not JBoss code either.


                    But maybe you can still help me,
                    I checked my code of com.thalys.localys.frontal.MessageTrainCreator.marshall , and inside i use jaxb-api.jar ...


                    Which isn't shipped with JBoss-3.2.3
                    http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/tags/JBoss_3_2_3/thirdparty/sun/
                    it is part of JDK6 but that's irrelevant to you if you are on JDK1.4


                    And one of the librairies i added in JBoss libs was axis-jaxrpc-1.4 . Could this be a problem and create my exception??? Could there be a library conflict.


                    You want me to guess, without seeing the code and a single stacktrace
                    that shows an NPE? :-)

                    JBoss-3.2.3 included an older version of axis.
                    http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/tags/JBoss_3_2_3/thirdparty/apache/axis/
                    (3.2.3 is nearly 4 years old)

                    It is 1.0-RC1 according to this:
                    http://viewvc.jboss.org/cgi-bin/viewvc.cgi/jbossas/tags/JBoss_3_2_3/thirdparty/apache/axis/release-notes.html?revision=54874&view=markup

                    But any problems with Apache Axis aren't an issue for a JBoss JMS forum.
                    The only (very tentative) relationship is that you're using Axis from an MDB
                    in the business method.

                    • 8. Re: Exception in JMSCI message listener
                      Nicolas Daudin Newbie

                      OK thanks for the reply, i will try with the few links you gave me and find the correct forum to solve my problem. I guess your links will help me anyway.

                      Thank you very much.

                      • 9. Re: Exception in JMSCI message listener
                        Nicolas Daudin Newbie

                         

                        But any problems with Apache Axis aren't an issue for a JBoss JMS forum.
                        The only (very tentative) relationship is that you're using Axis from an MDB
                        in the business method.


                        And is this wrong?

                        My business method look like this

                        package com.thalys.localys.frontal;
                        
                        /** imports */
                        import java.io.ByteArrayOutputStream;
                        import java.io.IOException;
                        import java.io.InputStream;
                        import java.io.StringWriter;
                        
                        import java.util....
                        ...
                        
                        import javax.naming.NamingException;
                        
                        import javax.xml.bind.JAXBContext;
                        import javax.xml.bind.JAXBException;
                        import javax.xml.bind.Marshaller;
                        import javax.xml.bind.PropertyException;
                        import javax.xml.bind.Unmarshaller;
                        
                        import com.thalys.localys.xmlmodel....
                        ...
                        
                        import com.sun.xml.bind.StringInputStream;
                        
                        /**
                         * Class name: MessageTrainCreator
                         *
                         *
                         */
                        public class MessageTrainCreator {
                         // ~ Static fields/initializers
                         // -----------------------------------------------
                        
                         private static ObjectFactory objFactory;
                        
                         private static JAXBContext jc = null;
                        
                         static {
                         try {
                         jc = JAXBContext.newInstance("com.thalys.localys.xmlmodel");
                        
                         // creating the ObjectFactory
                         objFactory = new ObjectFactory();
                         } catch (JAXBException e) {
                         }
                         }
                        
                         // ~ Instance fields
                         // ----------------------------------------------------------
                        
                         private SolBordMessage msg = null;
                        
                         // ~ Methods
                         // ------------------------------------------------------------------
                        
                         /**
                         * Create a new instance of a message
                         *
                         * @return SolBordMessage created from XMLModel ObjectFactory
                         *
                         * @throws JAXBException
                         */
                         public SolBordMessage openMessage() throws JAXBException {
                         // create an empty PurchaseOrder
                         msg = objFactory.createSolBordMessage();
                        
                         return msg;
                         }
                        
                         /** irrelevant methods here, erased from the quote for better lisibility */
                        
                        
                         /**
                         * Generate the xml file by doing a marshaling operation.
                         *
                         * @return byte array representation of the xml file
                         *
                         * @throws PropertyException
                         * @throws JAXBException
                         * @throws NamingException
                         */
                         public byte[] marshallMessage() throws PropertyException, JAXBException,
                         NamingException {
                         // create a byte array output stream
                         ByteArrayOutputStream ostram = new ByteArrayOutputStream();
                        
                         Marshaller m = jc.createMarshaller();
                         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                        
                         // Marshall the message to an xml file
                         m.marshal(msg, ostram);
                        
                         byte[] content = ostram.toByteArray();
                         msg = null;
                        
                         return content;
                         }
                        
                         /**
                         * Generate the xml file by doing a marshaling operation.
                         *
                         * @return String representation of the xml file
                         *
                         * @throws PropertyException
                         * @throws JAXBException
                         * @throws NamingException
                         */
                         public String marshall() throws PropertyException, JAXBException,
                         NamingException {
                         // create a byte array output stream
                         StringWriter sw = new StringWriter();
                        
                         Marshaller m = jc.createMarshaller();
                         m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
                        
                         // Marshall the message to an xml file
                         m.marshal(msg, sw);
                        
                         return sw.toString();
                         }
                        
                         /**
                         * Generate SolBordMessage by doing an unmarshaling operation on the message
                         * string
                         *
                         * @param msg
                         * String message to be unmarshalled
                         *
                         * @return SolBordMessage message
                         *
                         * @throws JAXBException
                         */
                         public static SolBordMessage unmarshall(String msg) throws JAXBException {
                         // transform String into input stream
                         InputStream is = new StringInputStream(msg);
                        
                         // create a JAXB context capable of handling classes generated into
                         // the com.thalys.localys.xmlmodel package
                         JAXBContext jc = JAXBContext.newInstance("com.thalys.localys.xmlmodel");
                        
                         // create an Unmarshaller
                         Unmarshaller u = jc.createUnmarshaller();
                        
                         // activate unmarshalling validation of the xml file
                         u.setValidating(true);
                        
                         // unmarshal a po instance document into a tree of Java content
                         // objects composed of classes from the primer.po package.
                         return (SolBordMessage) u.unmarshal(is);
                         }
                        }
                        


                        • 10. Re: Exception in JMSCI message listener
                          Adrian Brock Master

                          It is if the static initialization threw a JAXBException, jc will be null.
                          But that's not a JMS question either.