-->
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: Tomcat 5.5 / Hibernate Annotations EntityManager 3.2 Probl
PostPosted: Tue Dec 05, 2006 8:44 am 
Newbie

Joined: Mon Dec 04, 2006 12:12 pm
Posts: 5
Hello all,

I have gotten Hibernate Annotations and the EntityManager working in my J2SE 5 environment w/o issue. I create a JAR file with all of the hibernate annotated classes and have a persistence.xml file in the META-INF directory of the my JAR file with all the hibernate properties.

This setup works fine in J2SE. However, when running as a web application in Tomcat, I get the following error:

INFO: Not binding factory to JNDI, no JNDI name configured


I have all the required libraries in the WEB-INF/lib directory of my war file. Does anyone know what could be the issue? I got this error before when there was a configuration error. However, the same persistence.xml works fine in the J2SE enviroment so I don't know what could be the issue here. Any help would be greatly appreciated.

Code:
@PersistenceUnit private static EntityManagerFactory mFactory = null;
   
   public static EntityManagerFactory getEntityManagerFactory() {
      if (mFactory == null) {
         mFactory = Persistence.createEntityManagerFactory("f1");
      }
      return mFactory;
   }



PERSISTENCE.XML

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence>
  <persistence-unit name="f1">
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.connection.username" value="root"/>
         <property name="hibernate.connection.password" value=""/>
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/f1"/>
         <property name="hibernate.max_fetch_depth" value="3"/>
      </properties>
  </persistence-unit>
</persistence>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 05, 2006 8:12 pm 
Newbie

Joined: Mon Dec 04, 2006 12:12 pm
Posts: 5
Anybody please? :)


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.