[hibernate-issues] [Hibernate-JIRA] Created: (HHH-7099) Unable to build EntityManagerFactory with not-JTA Datasource
Wilson Horstmeyer Bogado (JIRA)
noreply at atlassian.com
Tue Feb 21 15:52:09 EST 2012
Unable to build EntityManagerFactory with not-JTA Datasource
------------------------------------------------------------
Key: HHH-7099
URL: https://hibernate.onjira.com/browse/HHH-7099
Project: Hibernate ORM
Issue Type: Bug
Components: entity-manager
Affects Versions: 4.1.0, 4.0.1
Environment: Tomcat 7, Java 7, Hibernate 4.x, Servlet 3.0
Reporter: Wilson Horstmeyer Bogado
Attachments: HibernateTest.zip
When upgrading from Hibernate 3.6.x to Hibernate 4.x it is not possible to create an entity manager factory using a non-JTA Datasource in persistence.xml. When looking up the datasource with JNDI a "javax.naming.NamingException: This context must be accessed through a java: URL" exception is thrown. Debugging the source code we can see that in 3.6.x the lookup is done with "javax.naming.lookup(String)" but in 4.x it is done with "javax.naming.lookup(Name)" which fails.
The attached file is a test case. To reproduce, do the following:
1. Build the project with Maven
2. Deploy to Tomcat
3. Go to /hibernate-test/test
Result: All database records are shown in browser
Now, in pom.xml file, change hibernate.core.version property from 3.6.10.Final to 4.1.0.Final.
Repeat above steps.
Result: an exception stack trace is displayed which ends with:
Caused by: javax.naming.NamingException: This context must be accessed through a java: URL
at org.apache.naming.SelectorContext.parseName(SelectorContext.java:776)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:135)
at javax.naming.InitialContext.lookup(InitialContext.java:415)
at org.hibernate.service.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:65)
... 42 more
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list