geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <>
Subject Re: Persistence unit deploy error in 2.1 but works in 2.02
Date Mon, 31 Mar 2008 20:37:58 GMT
It's generally considered more polite to continue the original thread  
you start, answering requests for more information, rather than to  
appear to ignore responses and start new threads on the same topic.
In this case I realize you may be having problems with your mail  
On Mar 31, 2008, at 1:25 PM, luoluo wrote:

> Hi,
> I have an application using JPA with hibernate. I changed the  
> persistence
> provider to hibernate and trying to using db-pools.  It works  
> perfectly fine
> in Geronimo 2.02. But when I tried to deploy it to Geronimo 2.1. It  
> throw
> out an exception with can not find JNDI entry for the data source when
> Geronimo try to start the application.
> in persistence.xml, I use below to refer the data source:
> <persistence-unit name="CMWS">
> 	<provider>org.hibernate.ejb.HibernatePersistence</provider>
> 	<properties>
> 		<property name="hibernate.archive.autodetection"
> 				value="class" />
> 	        <property name="hibernate.connection.datasource"
> 				value="java:/comp/env/jdbc/CmwsDS" />
> ...
> The data source is created and defined in web.xml too.
> I found the different between 2.0.2 and 2.1.  In 2.0.2, the entity  
> manager
> was initialized when first time db-access. At that time, the data  
> source is
> already be registered in JNDI as /comp/env/jdbc/...DS.
> In 2.1, Geronimo try to initialize the entity manager when starting  
> the
> application. The sequence is wrong. It tried to find the data  
> source before
> the reference in Web.xml been registered. So the JNDI entry not find
> exception was thrown out.
> Is that a bug of Geronimo 2.1? Is there any way to work around this  
> issue in
> 2.1?

I recommend you use the jpa standard way of specifying datasources  
for jpa (using the jta-datasource and non-jta-datasource elements)  
rather than this hibernate specific way using a hibernate specific  
property.  Since in geronimo the jpa standard way does not rely on  
jndi, you will not have this problem.

Can you provide a stack trace of the problem you are seeing?  That  
would help figure out what is causing the earlier initialization.

david jencks

> Thanks!
> Bill
> -- 
> View this message in context: 
> unit-deploy-error-in-2.1-but-works-in-2.02- 
> tp16396504s134p16396504.html
> Sent from the Apache Geronimo - Users mailing list archive at  

View raw message