title: EJB3Unit testing no-tx-datasource
body: <p>I am doing tests on an ejb3-project using ejb3unit <a href="http://ejb3unit.sourceforge.net/Session-Bean.html" rel="nofollow noreferrer">http://ejb3unit.sourceforge.net/Session-Bean.html</a> for testing. All my Services long for @PersistenceContext (UnitName=bla). I set up the ejb3unit.properties like this:</p>
  
  <pre><code>ejb3unit_jndi.1.isSessionBean=true
  ejb3unit_jndi.1.jndiName=ejb/MyServiceBean
  ejb3unit_jndi.1.className=com.company.project.MyServiceBean
  </code></pre>
  
  <p>everything works with the in-memory-database.</p>
  
  <p>So now i want additionally test another servicebean with @PersistenceContext (UnitName=<em>noTxDatasource</em>) that goes for a <em></em> defined in my datasources.xml:</p>
  
  <pre><code>&lt;datasources&gt;
     &lt;local-tx-datasource&gt;
      ...
     &lt;/local-tx-datasource&gt;
     &lt;no-tx-datasource&gt;
       &lt;jndi-name&gt;noTxDatasource&lt;/jndi-name&gt;
       &lt;connection-url&gt;...&lt;/connection-url&gt;
       &lt;driver-class&gt;oracle.jdbc.OracleDriver&lt;/driver-class&gt;
       &lt;user-name&gt;bla&lt;/user-name&gt;
       &lt;password&gt;bla&lt;/password&gt;
     &lt;/no-tx-datasource&gt;
   &lt;/datasources&gt;
  </code></pre>
  
  <p>How do I tell ejb3unit to make this work:</p>
  
  <pre><code>Object object = InitialContext.doLookup("java:/noTxDatasource");
  if (object instanceof DataSource) {
    return ((DataSource) object).getConnection();
  } else { 
    return null;
  }
  </code></pre>
  
  <p>Currently it fails saying: javax.NamingException: Cannot find the name (noTxDataSource) in the JNDI tree Current bindings: (ejb/MyServiceBean=com.company.project.MyServiceBean)</p>
  
  <p>How can I add this no-tx-datasource to the jndi bindings?</p>