-->
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.  [ 3 posts ] 
Author Message
 Post subject: Persistence.xml is ignored
PostPosted: Tue Nov 21, 2006 5:01 am 
Newbie

Joined: Wed Aug 18, 2004 10:44 am
Posts: 14
Hi

I have a well-working JPA application running on Tomcat 5.5. All my entityes are located in a jar-file with a persistence.xml-file in the META-INF.

The application works fine on my test-server Tomcat 5.5.20 but fails on another test-server Tomcat 5.5.

I get the error:

Code:
   at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
   at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
   at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
   ... 31 more
Caused by: java.sql.SQLException: Invalid authorization specification,  message from server: "Access denied for user 'theusername'@'theserver' (using password: YES)"
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1977)
   at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1900)
   at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:2471)
   at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:813)
   at com.mysql.jdbc.Connection.createNewIO(Connection.java:1771)
   at com.mysql.jdbc.Connection.(Connection.java:440)
   at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
   at java.sql.DriverManager.getConnection(DriverManager.java:525)
   at java.sql.DriverManager.getConnection(DriverManager.java:140)
   at org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
   at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:417)
   ... 45 more


In persistence.xml I have not defined the username to be 'theusername' etc. No matter what I do in persistence.xml it is ignored (even writing some wrong XML). My conclusion so far is, that the persistence.xml-file is never read on Tomcat 5.5.

The people running the server are telling me, that they have created a JNDI-ressource in <DefaultContext>. Could this be the problem?

It seems like
Code:
Persistence.createEntityManagerFactory("manager1");


Is receiving an entitymanager based on the <DefaultContext>?

Regads,
René


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 23, 2006 1:26 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
can you post your persistence.xml?

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 5:30 am 
Newbie

Joined: Wed Aug 18, 2004 10:44 am
Posts: 14
Sorry, I forgot to respond to my own posting.

It seems like on Tomcat 5.0.20 the entities should not reside in an external jar, but directly in the WAR-file.

And the persistence.xml should not be in /META-INF/persistence.xml but located in the classpath hence WEB-INF/classes/META-INF otherwise it is ignored :-)

Regards,
René


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.