-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Hibernate 4.3 + Tomcat 7 Unable to lookup JNDI name
PostPosted: Sat Nov 23, 2013 6:37 pm 
Newbie

Joined: Sat Nov 23, 2013 6:10 pm
Posts: 1
I have a trouble upgrading to Hibernate 4.3.x from 4.2.7. I got this exception:

Code:
Caused by: javax.naming.NameNotFoundException: Name [java:comp/env/jdbc/data] is not bound in this Context. Unable to find [java:comp].
at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
at javax.naming.InitialContext.lookup(InitialContext.java:415)
at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:114)
... 82 more


I'm using Tomcat 7.0.29 (tried 7.0.47 as well) and JDK 7 (v25). There is no problem with Hibernate 4.2.7.

Here is my persistence.xml:
Code:
<persistence-unit name="data" transaction-type="RESOURCE_LOCAL">
    <non-jta-data-source>java:comp/env/jdbc/data</non-jta-data-source>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
        <property name="hibernate.hbm2ddl.auto" value="update" />
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="true" />
    </properties>
</persistence-unit>


But I don't think the problem is here. I did a little bit of debug research and found out the following:

Code:
JndiServiceImpl#locate(String jndiName)
creates an initial context which differs.

4.3.0 - org.apache.naming.NamingContext

4.2.7 - org.apache.naming.SelectorContext

Except for this, I couldn't find any more differences.

Thanks for any help.


Top
 Profile  
 
 Post subject: Re: Hibernate 4.3 + Tomcat 7 Unable to lookup JNDI name
PostPosted: Mon Nov 25, 2013 10:34 pm 
Newbie

Joined: Thu Nov 21, 2013 3:58 am
Posts: 2
I use Hibernate 3.6f and not JPA config:
...
<hibernate-configuration>
<session-factory name="sfEerp">
<property name="connection.datasource">java:/comp/env/jdbc/dsEerp</property>

...

for JBoss71 Hibernate 42 this xml JPA config:
...
<persistence-unit name="pueerp">
<jta-data-source>java:jboss/datasources/dsEerp</jta-data-source>
<mapping-file>META-INF/orm.xml</mapping-file>
<properties>
<!-- Properties for Hibernate -->
<property name="javax.persistence.validation.mode" value="none" />
<property name="hibernate.hbm2ddl.auto" value="validate" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.