7 Replies Latest reply on Jan 31, 2007 2:31 PM by alllle

    Problem if messaging client deployed within same VM

    alllle

      I have been struggling with deploying JBoss Messaging 1.0.1SP2 for a couple of days and got no luck. Please help.

      What I need is to be able to send/receive messages in my EJB3 that is deployed in the same JBoss server as the JBoss Messaging.

      I followed the instruction on the user manual for the installation, the example/queue runs okay. However, example/stateless fails with ClassNotFoundException for the org.jboss.jms.destination.JBossQueue class. I assume it is because the messaging is scoped and therefore, the example EJB "StatelessSessionExample" can't find the messaging classes.

      I thought of two ways to deal with it:
      1. put the jboss-messaging-client.jar to the server's lib directory so it is available to all apps.
      2. Include the jboss-messaging-client.jar in the application I am deploying, in this case, the example stateless EJB.
      And both approaches gave me this error:

      javax.jms.InvalidDestinationException: Not a JBossDestination:JBossQueue[testQueue]


      Apparently, due to the scoped deployment of the messaging, when I try to access the queue from inside the same JBoss AS, it uses two different loaders to load the same JBossQueue class (packaged in different jar files, one from messaging, one from client jar), and therefore, thinks that they are different class types.

      I am actually surprised that I could not find any existing post that discusses this problem. Did I missed something very basic?


      As a side note, I could not package the jboss-messaging-client.jar in my application's EAR. It caused weird deployment problems due to class conflicts. I got some attribute setting error and my datasource would not deploy. The grand jboss-messaging-client.jar contains so many packages/classes that are already exist in the JBoss AS server and it is impossible to isolate which one is actually causing the error.
      one is causing the problem.

        • 1. Re: Problem if messaging client deployed within same VM
          peterj

          The jboss-messaging-client.jar file is only for use with a stand-alone messaging client. You do not need it for a messaging client that is deployed to the application server. All of the necessary classes should already be in the jar files in the server/default/lib directory.

          • 2. Re: Problem if messaging client deployed within same VM
            alllle

             

            "PeterJ" wrote:
            The jboss-messaging-client.jar file is only for use with a stand-alone messaging client. You do not need it for a messaging client that is deployed to the application server. All of the necessary classes should already be in the jar files in the server/default/lib directory.


            Thank you for the reply!

            But I don't think the messaging classes are available on the server side though. As I mentioned in the first post, I got ClassNotFound exception when trying to retrieve the queue object. This is because the JBoss Messaging is deployed in scoped classloader.

            Further, I think the classes under the jboss-messaging.sar are missing some classes required by messaging clients. I copied all the jar files under that directory into the server's lib dir and still got exceptions for missing classes.

            • 3. Re: Problem if messaging client deployed within same VM
              alllle

              I just got it work, but I don't know if I did it the correct way. So if your solution is different, please post as well.

              I commented out the scoped classloader for the JBoss Messaging in the jboss-messaging.sar/META-INF/jboss-service.xml file, then copied the jboss-messaging-client.jar into the server's lib directory. It seems that the example/stateless is working fine with this setting.

              As I said, please post it if you've done it differently.

              • 4. Re: Problem if messaging client deployed within same VM
                peterj

                All I did was follow the installation instructions that came with Messaging (ran the util/release-admin.xml Ant script). Well, I also switch databases to MySQL or PostgreSQL. However, the only messaging client I am using in the app server is a message-driven EJB.

                • 5. Re: Problem if messaging client deployed within same VM
                  alllle

                   

                  "PeterJ" wrote:
                  All I did was follow the installation instructions that came with Messaging (ran the util/release-admin.xml Ant script). Well, I also switch databases to MySQL or PostgreSQL. However, the only messaging client I am using in the app server is a message-driven EJB.


                  Yep, I used the same script to install the messaging. I haven't deployed any MDB yet due to the errors I got but I will be putting one there soon.

                  Can you try to run the example/stateless? It should do a automatic deploy of a EJB and uppon successful running it, it will undeploy it automatically.

                  • 6. Re: Problem if messaging client deployed within same VM
                    alllle

                    It turns out that my solution mentioned above didn't work. I am using EJB3 and when I deploy my application with above settings, I got the following exceptions for each EJB I deploy:

                    19:54:33,504 INFO ejb3.JmxKernelAbstraction - installing MBean: jboss.j2ee:ear=app.ear,jar=app.jar,
                    name=AdminServiceBean,service=EJB3 with dependencies:
                    19:54:33,514 WARN system.ServiceController - Problem starting service jboss.j2ee:ear=app.ear,jar=app.jar,name=AllocationServiceBean,service=EJB3
                    java.lang.NullPointerException
                     at org.jboss.ejb3.injection.ResourceHandler.loadFieldInjectors(ResourceHandler.java:283)
                     at org.jboss.ejb3.injection.ResourceHandler.loadFieldInjectors(ResourceHandler.java:271)
                     at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:401)
                     at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:381)
                     at org.jboss.ejb3.EJBContainer.resolveInjectors(EJBContainer.java:640)
                     at org.jboss.ejb3.EJBContainer.initializePool(EJBContainer.java:576)
                     at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:507)
                     at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:82)
                     at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:80)
                     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 org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
                     at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
                    
                    ......
                    


                    And of course the EAR failed to deploy.

                    Any help is appreciated!


                    • 7. Re: Problem if messaging client deployed within same VM
                      alllle

                      Just a quick note for the final resolution I used:
                      I took the big jboss-messaging-client.jar file, ripped every thing out except the following packages:
                      - org.w3c.dom
                      - org.jboss.util.*
                      - org.jboss.serial.*
                      - org.jboss.net.*
                      - org.jboss.mx.*
                      - org.jboss.logging.*
                      - EDU.oswego.*

                      I then put this jar file into the server_config/lib folder.

                      And that seems to allow me to access queue/topics from inside the server.

                      My MDB still have problem which I opened a new thread athttp://www.jboss.com/index.html?module=bb&op=viewtopic&t=100317