9 Replies Latest reply on Mar 11, 2008 3:28 PM by clebert.suconic

    having problems getting started with JMS in JBoss 5 Beta 4

    rexer

      Hi,

      I'm a newbie trying to get messaging to work in the jboss 5 beta 4. Having some problems which I tried to google-up and getting nowhere. Any hints from you folks are much appreciated.

      I modified destinations-service.xml to include my test queue definition.

       <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=testQueue"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
       <depends optional-attribute-name="ServerPeer">
       jboss.messaging:service=ServerPeer
       </depends>
       <depends>jboss.messaging:service=PostOffice</depends>
       <attribute name="SecurityConfig">
       <security>
       <role name="guest" read="true" write="true"/>
       <role name="publisher" read="true" write="true" create="false"/>
       <role name="noacc" read="false" write="false" create="false"/>
       </security>
       </attribute>
       </mbean>
      


      When I start jboss I see correctly that the queue is created:

      13:59:48,548 INFO [QueueService] Queue[/queue/testQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
      


      I used NetBeans 6.0.1 to create EJB app. I added an MDB using the wizard and connected to to queue 'queue/testQueue'.

      My jboss.xml is:

      <jboss>
       <enterprise-beans>
       <message-driven>
       <ejb-name>NewMessageBean</ejb-name>
       <jndi-name>NewMessageBean</jndi-name>
       <destination-jndi-name>queue/testQueue</destination-jndi-name>
       </message-driven>
       </enterprise-beans>
      </jboss>
      


      the ejb-jar.xml is:

      <ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
       <enterprise-beans>
       <message-driven>
       <display-name>NewMessageMDB</display-name>
       <ejb-name>NewMessageBean</ejb-name>
       <ejb-class>org.rex.NewMessageBean</ejb-class>
       <transaction-type>Container</transaction-type>
       <message-destination-type>javax.jms.Queue</message-destination-type>
       <message-destination-link>testQueue</message-destination-link>
       <activation-config>
       <activation-config-property>
       <activation-config-property-name>acknowledgeMode</activation-config-property-name>
       <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
       </activation-config-property>
       <activation-config-property>
       <activation-config-property-name>destinationType</activation-config-property-name>
       <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
       </activation-config-property>
       </activation-config>
       </message-driven>
       </enterprise-beans>
       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>NewMessageBean</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       <message-destination>
       <display-name>Destination for NewMessageMDB</display-name>
       <message-destination-name>testQueue</message-destination-name>
       </message-destination>
       </assembly-descriptor>
       </ejb-jar>
      


      Looks like NetBeans is not yet compatible with jboss 5: you can't register servers (domain drop-down ends up being empty) and so you can't do deployments from NetBeans. So here is what I did to manually deploy my test app: I build the .jar and put it under server/default/deploy and I see the server starting the deployment. I see the exception shown below and that's where I am getting stuck:

      exception: jndi-name not found as a child of message-driven

      details:

      15:19:51,173 ERROR [AbstractKernelController] Error installing to Parse: name=vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar state=Not Installed m
      ode=Manual requiredState=Parse
      org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar
      .........
      15:19:51,242 WARN [HDScanner] Failed to process changes
      org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
      
      *** CONTEXTS IN ERROR: Name -> Error
      
      vfsfile:/usr/local/jboss-5.0.0.Beta4/server/default/deploy/Test1-ejb.jar -> org.jboss.xb.binding.JBossXBRuntimeException: jndi-name not found as a child of message-driven
      
      
       at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:576)
       at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:559)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:291)
       at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
       at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
       at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
       at java.lang.Thread.run(Thread.java:619)
      



      If I remove jndi-name element from jboss.xml (I added it after NetBeans MDB wizard), I get following error during deployment:

      jboss.j2ee:binding=message-driven-bean,jndiName=local/NewMessageBean@24490290,plugin=invoker,service=EJB -> org.jboss.deployment.DeploymentException: The message-destination 'testQueue' has no jndi-name in jboss.xml
      


      So it seems I'm providing wrong jndi-name which for some reason is a required param in Jboss 5. Perhaps the jndi-name is correct but my NewMessageBean class is somenow not compliant with something. I wonder if this has anything to do with differences between JBoss MQ and Jboss Messaging. I suspect NetBeans generated the code and config files targeted for JBoss MQ.

      My MDB class head is:

      public class NewMessageBean implements MessageDrivenBean, MessageListener { ...


      I'm new to enterprise beans in general so I'm sorry if I'm missing something obvious.






        • 1. Re: having problems getting started with JMS in JBoss 5 Beta
          czar_iv

          I've been trying something similar on jboss 5 beta 4 and I am able to deploy the message-driven MBean. I am using EJB3.0 with annotations to avoid the XML files. My problem is that Mbean will not receive the actual JMS message. The Jboss throws ClassCastException. I am starting to think that jboss 5 beta 4 does not fully support JBoss Messaging yet.

          • 2. Re: having problems getting started with JMS in JBoss 5 Beta
            peterj

            czar_iv, I have a EJB3 MDB (configured using annotations, no xml) running in beta4. If I recall correctly, I have to bring the server up first and then deploy the jar containing the MDB. After that it works just fine.

            Oh, and you should have started a new post.

            • 3. Re: having problems getting started with JMS in JBoss 5 Beta
              czar_iv

              PeterJ,

              What version of JBoss messaging are you using? I am using 1.4.0.SP2.

              • 4. Re: having problems getting started with JMS in JBoss 5 Beta
                timfox

                 

                "czar_iv" wrote:
                PeterJ,

                What version of JBoss messaging are you using
                I am using 1.4.0.SP2.


                That's strange.

                JBoss AS 5.0 beta 4 comes *pre-installed* with JBoss Messaging 1.4.1.beta1 (see http://anonsvn.jboss.org/repos/jbossas/tags/JBoss_5_0_0_Beta4/build/build-thirdparty.xml).

                Are you saying you have removed that and re-installed 1.4.0.SP2 instead?

                That seems a strange thing to do......

                • 5. Re: having problems getting started with JMS in JBoss 5 Beta
                  czar_iv

                  ok, I am obviously new to JBoss and JBoss Messaging; I was trying the examples from JBoss Messaging 1.4.0 SP1. I'll download JBoss Messaging 1.4.1 beta 1 and try those examples. Thanks!

                  • 6. Re: having problems getting started with JMS in JBoss 5 Beta
                    timfox

                     

                    "czar_iv" wrote:
                    ok, I am obviously new to JBoss and JBoss Messaging; I was trying the examples from JBoss Messaging 1.4.0 SP1. I'll download JBoss Messaging 1.4.1 beta 1 and try those examples. Thanks!


                    You don't need to download anything apart from the app server.

                    If you are using JBoss 5, JBoss Messaging is an integral part of the app server, there's no need to install anything else, it's already there.

                    Download JBoss AS 5, create a standard MDB, deploy it, and you are *already* using JBM.

                    JBM is the default JMS provide in JBoss AS 5.0

                    Hope that helps :)

                    • 7. Re: having problems getting started with JMS in JBoss 5 Beta
                      rexer

                      So can anybody see any obvious problems with my experimental code I posed in my original question?

                      Sounds like most of you have tried annotations instead of using XML. Are those generally more reliable?

                      I'll try to find the examples you folks are referring to.

                      Thanks again!

                      • 8. Re: having problems getting started with JMS in JBoss 5 Beta
                        timfox

                         

                        "rexer" wrote:
                        So can anybody see any obvious problems with my experimental code I posed in my original question?

                        Sounds like most of you have tried annotations instead of using XML. Are those generally more reliable?

                        I'll try to find the examples you folks are referring to.

                        Thanks again!



                        You should ask on the AS or EJB3 forums - we're not really experts on those areas here.

                        • 9. Re: having problems getting started with JMS in JBoss 5 Beta
                          clebert.suconic

                           

                          "timfox" wrote:
                          "rexer" wrote:
                          So can anybody see any obvious problems with my experimental code I posed in my original question?

                          Sounds like most of you have tried annotations instead of using XML. Are those generally more reliable?

                          I'll try to find the examples you folks are referring to.

                          Thanks again!



                          You should ask on the AS or EJB3 forums - we're not really experts on those areas here.


                          +1


                          However it looks like you're missing something obvious...

                          Why don't you take a look at our MDB example (distributed with our download package) and try to find something wrong at your package.

                          After looking into that, maybe you would be able to ask other questions on the AS/EJB3 forums, or here if you have some specific question about JBossMessaging.