Set mongo db via JNDI in Tomcat <p>i have a persistence.xml with the following structure:</p> <pre><code>&lt;persistence-unit name="contacts_nosql" transaction-type="RESOURCE_LOCAL"&gt; &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt; &lt;jta-data-source&gt;java:comp/env/jdbc/MY_DS&lt;/jta-data-source&gt; &lt;class&gt;com.mydomain.model.User&lt;/class&gt; &lt;properties&gt; &lt;property name="eclipselink.target-database" value="org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"/&gt; &lt;property name="eclipselink.nosql.connection-spec" value="org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec"/&gt; &lt;property name="eclipselink.nosql.property.mongo.port" value="27017"/&gt; &lt;property name="eclipselink.nosql.property.mongo.host" value="someurl.de"/&gt; &lt;property name="eclipselink.nosql.property.mongo.db" value="mydb"/&gt; &lt;property name="eclipselink.logging.level" value="FINEST"/&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; </code></pre> <p>I want to set the properties via JNDI. I thought it is enough to write the following into the context.xml of the tomcat:</p> <pre><code>&lt;Resource name="jdbc/MY_DS" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="20" maxWait="10000" username="myuser" password="mypwd" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mydb?useUnicode=true&amp;amp;characterEncoding=utf8" validationQuery="SELECT 1" removeAbandoned="true" removeAbandonedTimeout="300" /&gt; </code></pre> <p>For some reason this does not work. </p> <p>I see this in the log: Exception Description: Unable to acquire a connection from driver [null], user [null] and URL [null].</p> <p>What is wrong or what do i have to add?</p>