Rookie mistake. (ii) Errors encountered when deploying the message-driven bean for an EJB

Source: Internet
Author: User

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/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.