I am using tomcat connection pool, jpa, hibernate. The datasource i created in context.xml of tomcat works fine if I try to get it using :
source = (DataSource) ((Context) c.lookup("java:comp/env")).lookup("jdbc/kids");
but if i specify this jndi datasource in persistence.xml
<persistence-unit name="kids-tomcat" transaction-type="JTA">
<jta-data-source>jdbc/kids</jta-data-source>
</persistence-unit>
I am getting following exception: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [jdbc/kids]
Any idea why it could happen !
kids
, then you can try specifyingjava:kids
in persistence.xml – Spellman