EJB3.0 deployment message Driven Bean throw Javax.naming.NameNotFoundException exception
The following error was encountered while deploying the message-driven bean for the EJB:
ERROR [Org.jboss.resource.adapter.jms.inflow.JmsActivation] (Workmanager (2)-2) Unable to reconnect Org.jboss.resource.adapter.jms.inflow.jmsactivationspec@2705ea (ra= org.jboss.resource.adapter.jms.jmsresourceadapter@737612 Destination=queue/myqueue destinationType= Javax.jms.Queue tx=true durable=false reconnect=10 provider=java:/defaultjmsprovider user=null Minsession=1 maxsession=15 keepalive=60000 usedlq=true dlqhandler= Org.jboss.resource.adapter.jms.inflow.dlq.GenericDLQHandler DLQJNDINAME=QUEUE/DLQ dlquser=null dlqmaxresent=5)
Javax.naming.NameNotFoundException:myqueue not bound
Solution One:
Add the following code to the Mail-service.xml file under the JBoss root directory \server\default\deploy:
<mbean code= "Org.jboss.mq.server.jmx.Queue" name= "Jboss.org.destination:server=queue,name=myqueue" >
<attribute name= "Jndiname" >queue/myqueue</attribute>
<depends optional-attribute-name = " Destinationmanager ">
jboss.mq:service=destinationmanager
</depends>
</mbean>
Solution Two:
Create a Xxx-service.xml file in the JBoss Server\default\deploy directory where xxx can take any value, but must be followed by the "-service" suffix, for example, Mdb-service.xml. The file can be placed in deploy or its subdirectories (which can be multiple subdirectories). The contents of the document are as follows:
<?xml version= "1.0" encoding= "UTF-8"?>
<server>
<mbean code= "Org.jboss.mq.server.jmx.Queue "Name=" Jboss.mq.destination:service=queue,name=myqueue ">
<depends optional-attribute-name=" Destinationmanager ">jboss.mq:service=DestinationManager</depends>
</mbean>
</ Server>
Reason:
The message-driven bean is annotated as follows:
@MessageDriven (
activationconfig = {
@ActivationConfigProperty (propertyname= "destinationtype"), Propertyvalue= "Javax.jms.Queue"),
@ActivationConfigProperty (propertyname= "Destination", propertyvalue= " Queue/myqueue ")
}
)
Message-driven beans need to be annotated with @messagedriven. Note that the value of the destination property is Queue/myqueue. JBoss does not create a queue object from itself, so you need to manually configure the queue object.
OK, you can solve this problem with one of the above solutions, just redeploy the message-driven bean we wrote and run the client, and you'll find that we have successfully invoked our message-driven bean.
Author: cnblogs Liu Shui
Back to the column page: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/