[jboss-user] [Messaging, JMS & JBossMQ] - JMS in JBoss 5 Beta

rexer do-not-reply at jboss.com
Mon Mar 3 21:37:36 EST 2008


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, d
  | ownCacheSize=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/jbo
  | ss-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/jb
  | oss-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(Scheduled
  | ThreadPoolExecutor.java:98)
  |         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Schedule
  | dThreadPoolExecutor.java:181)
  |         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadP
  | oolExecutor.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 at 24490290,plugin=invoker,service
  | =EJB -> org.jboss.deployment.DeploymentException: The message-destination 'testQueue' has no jndi-name in j
  | boss.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.


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133770#4133770

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133770



More information about the jboss-user mailing list