1 2 Previous Next 22 Replies Latest reply on Dec 23, 2008 9:49 AM by gaohoward

    MBean Servic cannot open jms session

    chipschoch

      I upgraded to JBossAS 4.2.0.GA and JBM1.3.0.GA and when I deploy my message handling MBean I get the following when it tries to create a jms session. I am not quite sure what this is even saying to me. Any insight as to what I need to do to fix this would be sincerely appreciated.

      2007-06-03 11:04:37,988 INFO [com.eLynx.Messaging.MessageReceiver] EMail ServiceService MessageReceiver thread started...
      2007-06-03 11:04:37,988 INFO [com.eLynx.Messaging.MessageReceiver] EMail Service Service started.
      2007-06-03 11:04:37,988 DEBUG [com.eLynx.Service.EMail.EMailService] Started eLynx.EMail:service=EMailService
      2007-06-03 11:04:45,315 ERROR [com.eLynx.Messaging.MessageReceiver] Exception running MessageReceiver [thread id=115].
      java.lang.NullPointerException
       at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:86)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
       at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
       at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
       at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
       at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)
       at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:269)
       at org.jboss.jms.client.JBossConnection.createSession(JBossConnection.java:91)
       at com.eLynx.Messaging.MessageReceiver.run(MessageReceiver.java:552)
      2007-06-03 11:04:46,424 ERROR [com.eLynx.Messaging.MessageReceiver] Exception closing JMS Session objects.
      java.lang.NullPointerException
       at org.jboss.jms.client.container.ClosedInterceptor.maintainRelatives(ClosedInterceptor.java:288)
       at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:165)
       at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
       at org.jboss.jms.client.delegate.ClientConnectionDelegate$closing_N1847373599029068216.invokeNext(ClientConnectionDelegate$closing_N1847373599029068216.java)
       at org.jboss.jms.client.delegate.ClientConnectionDelegate.closing(ClientConnectionDelegate.java)
       at org.jboss.jms.client.JBossConnection.close(JBossConnection.java:131)
       at com.eLynx.Messaging.MessageReceiver.run(MessageReceiver.java:629)


      Here is the code snippet where it occurs:

      // Lookup our JMS connection factory
       InitialContext context = getInitialContext ();
       QueueConnectionFactory connFactory = (QueueConnectionFactory) context
       .lookup (getProperty (MessageReceiverProperties
       .PropJMSConnectoryFactory));
      
       // Get our jms connection
       m_jmsConnection = connFactory.createQueueConnection ();
      
       // Get our jms session
       m_jmssession = m_jmsConnection.createSession (false, Session.AUTO_ACKNOWLEDGE);


        • 1. Re: MBean Servic cannot open jms session
          chipschoch

          I also have a web app from which I attempted to connect to JMS and I observe the same behavior.

          java.lang.NullPointerException
           at org.jboss.jms.client.container.FailoverValveInterceptor.invoke(FailoverValveInterceptor.java:86)
           at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
           at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
           at org.jboss.jms.client.container.ClosedInterceptor.invoke(ClosedInterceptor.java:170)
           at org.jboss.aop.advice.PerInstanceInterceptor.invoke(PerInstanceInterceptor.java:105)
           at org.jboss.jms.client.delegate.ClientConnectionDelegate$createSessionDelegate_6052335267724906805.invokeNext(ClientConnectionDelegate$createSessionDelegate_6052335267724906805.java)
           at org.jboss.jms.client.delegate.ClientConnectionDelegate.createSessionDelegate(ClientConnectionDelegate.java)
           at org.jboss.jms.client.JBossConnection.createSessionInternal(JBossConnection.java:269)
           at org.jboss.jms.client.JBossConnection.createSession(JBossConnection.java:91)
           at com.eLynx.Controller.TestController.testMessaging(TestController.java:110)
           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:585)
           at com.eLynx.Dispatch.XmlDispatcher.dispatch(XmlDispatcher.java:160)
           at com.eLynx.Dispatch.XmlDispatcher.dispatch(XmlDispatcher.java:81)
           at com.eLynx.Servlet.XmlWebappServlet.doPost(XmlWebappServlet.java:119)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


          The code in the servlet that the exception occurred on:

          m_initialContext = ConnectionManager.getInitialContext ();
           ConnectionFactory factory = (ConnectionFactory) m_initialContext.lookup ("/ConnectionFactory");
           m_jmsConnection = factory.createConnection ();
           m_jmsSession = (QueueSession) m_jmsConnection.createSession (false, Session.AUTO_ACKNOWLEDGE);
          


          • 2. Re: MBean Servic cannot open jms session
            timfox

            When you ran the example as part of the installation procedure (http://labs.jboss.com/file-access/default/members/jbossmessaging/freezone/docs/userguide-1.3.0.GA/html/installation.html#inst.validation), did the web services example work for you?

            • 3. Re: MBean Servic cannot open jms session
              timfox

              I just again validated all the examples after installing in a fresh 4.2.0.GA instance, if they don't work for you then it's likely to be a botched installation.

              • 4. Re: MBean Servic cannot open jms session
                timfox

                Are you deploying your MBean service as a scoped deployment?

                • 5. Re: MBean Servic cannot open jms session
                  chipschoch

                  I did not run the examples, but I will do that. What I did was:

                  1. Download and unzip JBossAS 4.2.0.GA
                  2. Download and unzip JVM 1.3.0.QA
                  3. run ant -f release-admin.xml
                  4. replace hssql with mssql everywhere
                  5. Add in my application dependent jars (jtds, groups etc.)
                  6. Start JBossAs
                  7. Deploy my hibernate archive, webapp and services.
                  8. Attempt to connect to JBM from each.

                  I have a test project that is able to post messages to JBM but it is not running in the same JVM as JBossAS. It uses the client libs and works fine. I have only seen this when trying to connect from processes running in the same JVM as JBossAS.

                  I tried both the webapp scoped and not scoped and it made no difference.

                  I am getting a new machine this afternoon so I will redo the installation and try it all again.

                  Thanks.

                  • 6. Re: MBean Servic cannot open jms session
                    chipschoch

                    One other thing. I am able to view my queue contents from jmx-console so that indicated that at least one webapp is able to make a connection to JMS. I am assuming that jmx goes through the JMS interface to look at the queue contents.

                    That would seem to indicate that something in my applications is causing the issue, would you agree?

                    • 8. Re: MBean Servic cannot open jms session
                      chipschoch

                      I ran the installation test and, as expected, it passed. However, the test is not executingin the same JVM as JBossAS and JBM, so given the fact that my test program worked I would expect the install test to pass.

                      • 9. Re: MBean Servic cannot open jms session
                        timfox

                        I suspect that something in your app (the mbean or the web app?) is specifying a loader repository.

                        There is a web service example in the examples that demonstrates a web service sending a message via JBM. If you look at this example and see how it differs from your non functioning web service, it might give you some clues as to what the problem might be.

                        • 10. Re: MBean Servic cannot open jms session
                          timfox

                           

                          "chip_schoch" wrote:
                          I ran the installation test and, as expected, it passed. However, the test is not executingin the same JVM as JBossAS and JBM, so given the fact that my test program worked I would expect the install test to pass.


                          Chip, please run *all* the non clustered examples. There is a web service example there too (where web service and JBM are running in the same VM).

                          • 11. Re: MBean Servic cannot open jms session
                            chipschoch

                            Thanks Tim. I wrote a simple webapp with a servlet that does a jms connection and it works fine so there is something peculiar to my other stuff that is messing with it. Sorry to raise the issue before fully pursuing it.

                            • 12. Re: MBean Servic cannot open jms session
                              chipschoch

                              Well Tim, here is what I have determined. I have three MBean Services that handle jms messages. They are essentially the same codebase. If any one of them has a scoped loader I get the exception I sent initially.

                              But only on the ones that load and initialize AFTER the one with the scoped loader. If a service without it loads and initializes before another one that has its loader scoped, then the first one works fine.

                              Not scoping the loader is not really an issue for me except that without it I don't seem to be able to separate my log4j log files on a per service basis using the TCLFilter. Is there any known work around for this?

                              Thanks

                              • 13. Re: MBean Servic cannot open jms session
                                clebert.suconic
                                • 14. Re: MBean Servic cannot open jms session
                                  clebert.suconic

                                  This is some Bug on AOP

                                  If fixing ClientAOPStackLoader like this:

                                  public synchronized void load(ConnectionFactoryEndpoint delegate) throws Exception
                                   {
                                   if (loaded)
                                   {
                                   return;
                                   }
                                  
                                   ClassLoader loaderOriginal = Thread.currentThread().getContextClassLoader();
                                  
                                   try
                                   {
                                   // This was done because of some weird behavior of AOP & classLoading
                                   // http://jira.jboss.org/jira/browse/JBMESSAGING-980
                                   Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
                                  
                                   byte[] clientAOPStack = delegate.getClientAOPStack();
                                  
                                   new JmsClientAspectXMLLoader().deployXML(clientAOPStack);
                                  
                                   loaded = true;
                                   }
                                   finally
                                   {
                                   Thread.currentThread().setContextClassLoader(loaderOriginal);
                                   }
                                   }
                                  


                                  It works without any problems.


                                  I have changed the MDBExample to be a scoped EAR. I'm committing this on the trunk now...

                                  Tim... should we create a SP/branch for this?

                                  1 2 Previous Next