title: How to configure Java Message Driven Beans and Websphere Activation specification without hardcoded JNDI Names?
body: <p>We have a MDB listening to a Queue reading data and sending data to another Queue</p>
  
  <pre><code>@MessageDriven(
          activationConfig = { @ActivationConfigProperty(
                  propertyName = "destinationType", propertyValue = "javax.jms.Queue"
          ) }, 
          mappedName = "jms/dataQ")
  public class DataMDB implements MessageListener {
  
  @Resource(name="jms/dataQueueConnectionFactory")
  private ConnectionFactory connectionfactory;
  
  @Resource(name="jms/dataDestinationQ")
  private Destination destination;
  
  ...
  }
  </code></pre>
  
  <p>and an XML (ibm-ejb-jar-bnd.xml) with bean configuration</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;ejb-jar-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns="http://websphere.ibm.com/xml/ns/javaee"
      xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee   http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd"
      version="1.0"&gt;
  
  &lt;message-driven name="DataMDB"&gt;
          &lt;jca-adapter activation-spec-binding-name="eis/dataListenerMDB"
              destination-binding-name="jms/dataQ" /&gt;
          &lt;resource-ref name="jms/dataQueueConnectionFactory"
              binding-name="jms/dataQueueConnectionFactory" /&gt;
          &lt;resource-env-ref name="jms/dataDestinationQ"
              binding-name="jms/dataDestinationQ" /&gt;
      &lt;/message-driven&gt;
  
  &lt;/ejb-jar-bnd&gt;
  </code></pre>
  
  <p>and Activation specification for this MDB on WebSphere</p>
  
  <p><img src="https://i.stack.imgur.com/Pk4ll.png" alt="WAS Activation Specification"></p>
  
  <p>As I have seen the examples over Google, this is the typical example of MDB and WAS Activation setup.</p>
  
  <p>We have a problem here as all the JNDI names seen here are hardcoded in Java code anotations as well as in the ibm-ejb-jar-bnd.xml file. </p>
  
  <p>So is there a way that these JNDI names can be brought outside the EJB project, so we could build one project for all customers and customers are free to have their Standard JNDI Names.</p>
  
  <p>Else we have to build different .ear for each customer and which is not ideal.</p>
  
  <p>Thanks in advance people.
  Any ideas are welcome.</p>