title: Creating multiple instances of one MessageDriven Bean
body: <p>I'm using a MessageDriven Bean in two different applications, and I'd like them to be separate instances using separate Queues.</p>
  
  <p><a href="https://stackoverflow.com/questions/6112760/mulitple-queues-in-ejb-messagedriven-annotation">This SO question</a> confirmed my notion that I should be able to set this up in the deployment descriptors (ejb-jar.xml? glassfish-ejb-jar.xml?). Maybe simply overriding the <code>mappedName</code> in the MDB's annotation is enough?</p>
  
  <p>I'd be thankful if someone could point me to a good example of how to do this in Glassfish (or clarify matters if I'm confusing things here).</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>To clarify, there's the MDB called <code>AnalyzerBean</code> and the Resource called <code>AnalyzerHelper</code> (the former reads from the Queue, the latter writes into it). Am I correct to assume that <code>&lt;ejb-ref-name&gt;</code> corresponds to the <code>name</code> attribute and <code>&lt;jndi-name&gt;</code> corresponds to the <code>mappedName</code> attribute?</p>
  
  <p>My glassfish-ejb-jar.xml now looks something like this. I'm trying to give unique JNDI names to Resource and MDB, but I keep getting errors:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE glassfish-ejb-jar PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 EJB 3.1//EN" "http://glassfish.org/dtds/glassfish-ejb-jar_3_1-1.dtd"&gt;
  &lt;glassfish-ejb-jar&gt;
     &lt;enterprise-beans&gt;
     &lt;ejb&gt;
       &lt;ejb-name&gt;analyzerBean&lt;/ejb-name&gt;
       &lt;jndi-name&gt;analyzerBean&lt;/jndi-name&gt;
  
       &lt;ejb-ref&gt;
         &lt;ejb-ref-name&gt;analyzerBean&lt;/ejb-ref-name&gt;
         &lt;jndi-name&gt;analyzerBeanQueue1&lt;/jndi-name&gt;
       &lt;/ejb-ref&gt;
  
       &lt;resource-ref&gt;
         &lt;res-ref-name&gt;analyzerHelper&lt;/res-ref-name&gt;
         &lt;jndi-name&gt;analyzerHelperResource1&lt;/jndi-name&gt;
       &lt;/resource-ref&gt;
     &lt;/ejb&gt;
     &lt;/enterprise-beans&gt;
  &lt;/glassfish-ejb-jar&gt;
  </code></pre>