Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 412031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:02:43+00:00 2026-05-12T18:02:43+00:00

I have an EAR application which contains an MDB and a WAR. In this

  • 0

I have an EAR application which contains an MDB and a WAR.

In this EAR application I would send a message into an another Queue from other EAR application. Say jms/anotherQueue

If the message sending happens in web context, it works.
I have such setup in web.xml

<message-destination-ref>
 <message-destination-ref-name>jms/anotherQueue</message-destination-ref-name>
 <message-destination-type>javax.jms.Queue</message-destination-type>
 <message-destination-usage>Produces</message-destination-usage>
 <message-destination-link>jms/anotherQueue</message-destination-link>
</message-destination-ref> 

But if the message sending occurs in EJB (MDB here) context, I will get a JNDI name lookup failure.

javax.naming.NameNotFoundException: anotherQueue

my ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

 <enterprise-beans>

  <message-driven>
   <ejb-name>jms/myMDB</ejb-name>
   <ejb-class>com.my.MDBImplement</ejb-class>
   <messaging-type>javax.jms.MessageListener</messaging-type>
   <transaction-type>Container</transaction-type>
   <activation-config>
    <activation-config-property>
     <activation-config-property-name>destination</activation-config-property-name>
     <activation-config-property-value>jms/myQueue</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>
   <resource-ref>
    <res-ref-name>jms/myCF</res-ref-name>
    <res-type>javax.jms.QueueConnectionFactory</res-type>
    <res-auth>Container</res-auth>
    <res-sharing-scope>Shareable</res-sharing-scope>
   </resource-ref>
  </message-driven>
 </enterprise-beans>

 <assembly-descriptor>
  <container-transaction>
   <method>
    <ejb-name>jms/myMDB</ejb-name>
    <method-name>onMessage</method-name>
    <method-params>
     <method-param>javax.jms.Message</method-param>
    </method-params>
   </method>
   <trans-attribute>NotSupported</trans-attribute>
  </container-transaction>
 </assembly-descriptor>


</ejb-jar>

the openejb.jar is

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ejb:openejb-jar
 xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
 xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
 xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
 xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
 xmlns:name="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence"
 xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
 xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
 <dep:environment>
  <dep:moduleId>
   <dep:groupId>myGroup</dep:groupId>
   <dep:artifactId>imyMDB</dep:artifactId>
   <dep:version>1.0</dep:version>
   <dep:type>ejb</dep:type>
  </dep:moduleId>
  <dep:dependencies>
   <dep:dependency>
    <dep:groupId>org.apache.geronimo.configs</dep:groupId>
    <dep:artifactId>activemq-broker</dep:artifactId>
    <dep:type>car</dep:type>
   </dep:dependency>
  </dep:dependencies>
 </dep:environment>
 <ejb:enterprise-beans>
  <ejb:message-driven>
   <ejb:ejb-name>jms/myMDB</ejb:ejb-name>
   <ejb:resource-adapter>
    <ejb:resource-link>myJmsResource</ejb:resource-link>
   </ejb:resource-adapter>
  </ejb:message-driven>
 </ejb:enterprise-beans>
</ejb:openejb-jar>

I define myJmsResource in geronimo-application.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<app:application
 xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
 xmlns:client="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"
 xmlns:conn="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2"
 xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ejb="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
 xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:pers="http://java.sun.com/xml/ns/persistence"
 xmlns:pkgen="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
 xmlns:web="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1">
 <dep:environment>
  <dep:moduleId>
   <dep:groupId>myGroup</dep:groupId>
   <dep:artifactId>myEAR</dep:artifactId>
   <dep:version>1.0</dep:version>
   <dep:type>ear</dep:type>
  </dep:moduleId>
 </dep:environment>
 <app:module>
  <app:connector>geronimo-activemq-ra-2.1.4.rar</app:connector>
  <conn:connector>
   <dep:environment>
    <dep:moduleId>
     <dep:groupId>myGroup</dep:groupId>
     <dep:artifactId>myJmsResource</dep:artifactId>
     <dep:version>1.0</dep:version>
     <dep:type>rar</dep:type>
    </dep:moduleId>
    <dep:dependencies>
     <dep:dependency>
    <dep:groupId>org.apache.geronimo.configs</dep:groupId>
      <dep:artifactId>activemq-broker</dep:artifactId>
      <dep:type>car</dep:type>
     </dep:dependency>
    </dep:dependencies>
   </dep:environment>
   <conn:resourceadapter>
    <conn:resourceadapter-instance>

     <conn:resourceadapter-name>myJmsResource</conn:resourceadapter-name>
     <nam:workmanager>
      <nam:gbean-link>DefaultWorkManager</nam:gbean-link>
     </nam:workmanager>
    </conn:resourceadapter-instance>
    <conn:outbound-resourceadapter>
     <conn:connection-definition>
      <conn:connectionfactory-interface>javax.jms.ConnectionFactory</conn:connectionfactory-interface>
      <conn:connectiondefinition-instance>
       <conn:name>jms/myCF</conn:name>
       <conn:implemented-interface>javax.jms.QueueConnectionFactory</conn:implemented-interface>
       <conn:implemented-interface>javax.jms.TopicConnectionFactory</conn:implemented-interface>
       <conn:connectionmanager>
        <conn:xa-transaction>
         <conn:transaction-caching />
        </conn:xa-transaction>
        <conn:single-pool>
         <conn:match-all />
        </conn:single-pool>
       </conn:connectionmanager>
      </conn:connectiondefinition-instance>
     </conn:connection-definition>
    </conn:outbound-resourceadapter>
   </conn:resourceadapter>
   <conn:adminobject>
    <conn:adminobject-interface>javax.jms.Queue</conn:adminobject-interface>
    <conn:adminobject-class>org.apache.activemq.command.ActiveMQQueue</conn:adminobject-class>
   <conn:adminobject-instance>     
     <conn:message-destination-name>jms/myQueue</conn:message-destination-name>
     <conn:config-property-setting name="PhysicalName">jms/myQueue</conn:config-property-setting>
    </conn:adminobject-instance>
    <!-- ******************************************************************** -->
    <!-- define referred message destination ??? -->
    <conn:adminobject-instance>
     <conn:message-destination-name>jms/anotherQueue</conn:message-destination-name>
     <conn:config-property-setting name="PhysicalName">jms/anotherQueue</conn:config-property-setting>
    </conn:adminobject-instance>
   </conn:adminobject>
   <conn:adminobject>
    <conn:adminobject-interface>javax.jms.Topic</conn:adminobject-interface>
    <conn:adminobject-class>org.apache.activemq.command.ActiveMQTopic</conn:adminobject-class>
   </conn:adminobject>
  </conn:connector>
 </app:module>

</app:application>

It seems that myMDB cannot understand what jms/anotherQueue is!!!
How can I fix it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T18:02:43+00:00Added an answer on May 12, 2026 at 6:02 pm

    OK, I found a quick fix….

    in ejb-jar.xml

    <enterprise-beans>
    
        <message-driven>
            <ejb-name>jms/myMDB</ejb-name>
                    .....      
            <!--  referred queue -->
            <resource-env-ref>
                <resource-env-ref-name>jms/anotherQueue</resource-env-ref-name>
                <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
            </resource-env-ref>
    
        </message-driven>
    </enterprise-beans>
    

    I must admit, I still don’t understand how to write a correct deployment plan.
    I just goggle, copy, paste…..and mix up those deployment plans.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple j2ee application: foo.ear - foo.war - foo.jar (ejb3 jar) I
I have a web application which deploys fine as an ear file. But when
I want to build a Java EE application (EAR) which not only provides web
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you used VS.NET Architect Edition's Application and System diagrams to start designing a
Have a n-tire web application and search often times out after 30 secs. How
Have you managed to get Aptana Studio debugging to work? I tried following this,
First some background information: We have three environments for our EJB3 application: test, development
I have a few separate application projects (EARs) with multiple EJBs that I want
Have just started using Google Chrome , and noticed in parts of our site,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.