[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-7099) Unable to build EntityManagerFactory with not-JTA Datasource

Wilson Horstmeyer Bogado (JIRA) noreply at atlassian.com
Sun Mar 25 15:41:48 EDT 2012


    [ https://hibernate.onjira.com/browse/HHH-7099?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46069#comment-46069 ] 

Wilson Horstmeyer Bogado commented on HHH-7099:
-----------------------------------------------

I have confirmed that there was a bug in Tomcat. Updated to Tomcat 7.0.26 and the error is gone.

> 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.0.1, 4.1.0
>         Environment: Tomcat 7, Java 7, Hibernate 4.x, Servlet 3.0
>            Reporter: Wilson Horstmeyer Bogado
>              Labels: jpa2
>         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