tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: problem with hibernate persistence provider
Date Thu, 15 May 2008 04:42:49 GMT

On May 14, 2008, at 5:46 AM, rolber wrote:

> Caused by: org.apache.openejb.OpenEJBException:
> java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence  
> cannot
> be cast to javax.persistence.spi.PersistenceProvider:
> org.hibernate.ejb.HibernatePersistence cannot be cast to
> javax.persistence.spi.PersistenceProvider
> 	at
> org 
> .apache 
> .openejb 
> .assembler.classic.Assembler.createApplication(Assembler.java:459)
> 	... 17 more
> Caused by: java.lang.ClassCastException:
> org.hibernate.ejb.HibernatePersistence cannot be cast to
> javax.persistence.spi.PersistenceProvider
> 	at
> org 
> .apache 
> .openejb 
> .assembler 
> .classic 
> .PersistenceBuilder 
> .createEntityManagerFactory(PersistenceBuilder.java:178)
[...]
> The library which uses hibernate, contains a package(ejb3- 
> persistence.jar)
> which also uses the class javax.persistence.spi.PersistenceProvider,
> the same as in javaee-api-5.0-1.jar package.

The ClassCastException is definitely caused by having two copies of  
the javax.persistence APIs in your system (one in the common  
classloader provided by us and the one in your webapp).  You'll  
definitely want to get rid of the jar in your webapp that contains the  
javax.persistence API.  Assuming that jar only contains javax.*  
classes, everything should run fine without it.

-David


Mime
View raw message