Jndi lookup doesn't found datasource with tomcat

Description

I migrate my application from hibernate 3 to 4, but at startup I got an exception that I couldn't get datasource. Seem that InitialContext is empty. I let tomcat manages connection.

Caused by: org.hibernate.service.jndi.JndiException: Unable to lookup JNDI name [java:comp/env/jdbc/myCompDb]
at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:68)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:116)

I ask on forum at:
https://forum.hibernate.org/viewtopic.php?f=1&t=1013101

Activity

Show:

Brett Meyer March 7, 2014 at 5:30 PM

Bulk closing rejected tickets in "resolved" state.

Steve Ebersole April 30, 2012 at 6:43 PM

Thanks for the follow up Adam.

Christian, well thats not entirely true assuming Bitronix also makes the datasource available via non-JNDI mechanism. Hibernate 4 is much better at not needing JNDI.

Adam Buckley April 30, 2012 at 6:27 PM

The persistence.xml fix (comment 45915) is also confirmed to work with Tomcat 6.0.26

Steve Ebersole March 13, 2012 at 2:45 PM

Thanks for following up Matthew.

Mathieu Vézeau March 12, 2012 at 9:52 PM

I tested the latest Tomcat 7 trunk (7.0.26-dev) and I confirm that it now works with stock Hibernate, eliminating the need for workarounds.

Rejected

Details

Assignee

Reporter

Affects versions

Priority

Created January 31, 2012 at 8:32 PM
Updated March 7, 2014 at 5:30 PM
Resolved March 13, 2012 at 2:45 PM