tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rolber <berger_rol...@gmx.de>
Subject problem with hibernate persistence provider
Date Wed, 14 May 2008 12:46:03 GMT

Hi all,
i'm new to openejb and the last week i play with the openejb-examples.
After some time, the examples works errorless.
I have found the great examples from:
http://javanotebook.com/2007/09/28/openejb_3_and_tomcat_6.html
I have change the db to mysql, add a simple remote-client to this example
and everything works very well.
My intention is, to use openejb in a allready existing webapplication.
This application make use of the HibernatePersistence (exacting the exPOJO
framework).

Now i try to use the HibernatePersistence for the example, but now i get a
strange error:
2008-05-14 13:35:26,985 - INFO  - openejb.home =
C:\_home\apps\apache-tomcat-6.0.16
2008-05-14 13:35:26,985 - INFO  - openejb.base =
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1
2008-05-14 13:35:27,916 - INFO  - Configuring Service(id=Tomcat Security
Service, type=SecurityService, provider-id=Tomcat Security Service)
2008-05-14 13:35:27,926 - INFO  - Configuring Service(id=Default Transaction
Manager, type=TransactionManager, provider-id=Default Transaction Manager)
2008-05-14 13:35:27,926 - INFO  - Configuring Service(id=My DataSource,
type=Resource, provider-id=Default JDBC Database)
2008-05-14 13:35:27,926 - INFO  - Configuring Service(id=My Unmanaged
DataSource, type=Resource, provider-id=Default JDBC Database)
2008-05-14 13:35:27,926 - INFO  - Configuring Service(id=My JMS Resource
Adapter, type=Resource, provider-id=Default JMS Resource Adapter)
2008-05-14 13:35:27,926 - INFO  - Configuring Service(id=My JMS Connection
Factory, type=Resource, provider-id=Default JMS Connection Factory)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=Default JDK 1.3
ProxyFactory, type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=My CMP Container,
type=Container, provider-id=Default CMP Container)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=My BMP Container,
type=Container, provider-id=Default BMP Container)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=My Stateful
Container, type=Container, provider-id=Default Stateful Container)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=My Stateless
Container, type=Container, provider-id=Default Stateless Container)
2008-05-14 13:35:27,936 - INFO  - Configuring Service(id=My MDB Container ,
type=Container, provider-id=Default MDB Container)
2008-05-14 13:35:28,267 - INFO  - Found EjbModule in classpath:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer\lib\openejb-core-3.0.jar
2008-05-14 13:35:28,587 - INFO  - Configuring app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer\lib\openejb-core-3.0.jar
2008-05-14 13:35:31,011 - INFO  - Loaded Module:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer\lib\openejb-core-3.0.jar
2008-05-14 13:35:31,021 - INFO  - Creating ProxyFactory(id=Default JDK 1.3
ProxyFactory)
2008-05-14 13:35:31,071 - INFO  - Creating TransactionManager(id=Default
Transaction Manager)
2008-05-14 13:35:31,291 - INFO  - Creating SecurityService(id=Tomcat
Security Service)
2008-05-14 13:35:31,351 - INFO  - Creating Resource(id=My DataSource)
2008-05-14 13:35:31,391 - INFO  - Creating Resource(id=My Unmanaged
DataSource)
2008-05-14 13:35:31,411 - INFO  - Creating Resource(id=My JMS Resource
Adapter)
2008-05-14 13:35:32,052 - INFO  - Creating Resource(id=My JMS Connection
Factory)
2008-05-14 13:35:32,062 - INFO  - Creating ConnectionManager for
Resource(id=My JMS Connection Factory)
2008-05-14 13:35:32,112 - INFO  - Creating Container(id=My CMP Container)
2008-05-14 13:35:32,152 - INFO  - Creating Container(id=My BMP Container)
2008-05-14 13:35:32,172 - INFO  - Creating Container(id=My Stateful
Container)
2008-05-14 13:35:32,202 - INFO  - Creating Container(id=My Stateless
Container)
2008-05-14 13:35:32,212 - INFO  - Creating Container(id=My MDB Container )
2008-05-14 13:35:32,232 - INFO  - Assembling app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer\lib\openejb-core-3.0.jar
2008-05-14 13:35:32,463 - INFO  -
Jndi(name=openejb/ConfigurationInfoBusinessRemote) -->
Ejb(deployment-id=openejb/ConfigurationInfo)
2008-05-14 13:35:32,463 - INFO  - Jndi(name=openejb/DeployerBusinessRemote)
--> Ejb(deployment-id=openejb/Deployer)
2008-05-14 13:35:32,473 - INFO  - Jndi(name=MEJB) -->
Ejb(deployment-id=MEJB)
2008-05-14 13:35:32,483 - INFO  - Created
Ejb(deployment-id=openejb/ConfigurationInfo,
ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
2008-05-14 13:35:32,483 - INFO  - Created
Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My
Stateless Container)
2008-05-14 13:35:32,483 - INFO  - Created Ejb(deployment-id=MEJB,
ejb-name=MEJB, container=My Stateless Container)
2008-05-14 13:35:32,483 - INFO  - Deployed
Application(path=C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer\lib\openejb-core-3.0.jar)
2008-05-14 13:35:32,533 - INFO  - Creating Resource(id=UserDatabase)
2008-05-14 13:35:33,364 - INFO  - Configuring app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT
2008-05-14 13:35:33,374 - INFO  - Loaded Module:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT
2008-05-14 13:35:33,374 - INFO  - Assembling app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT
2008-05-14 13:35:33,374 - INFO  - Deployed
Application(path=C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT)
2008-05-14 13:35:33,624 - INFO  - Configuring app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer
2008-05-14 13:35:33,634 - INFO  - Loaded Module:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer
2008-05-14 13:35:33,634 - INFO  - Assembling app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer
2008-05-14 13:35:33,634 - INFO  - Deployed
Application(path=C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer)
2008-05-14 13:35:41,987 - INFO  - Configuring app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
2008-05-14 13:35:42,047 - INFO  - Configuring
PersistenceUnit(name=ejb3example,
provider=org.hibernate.ejb.HibernatePersistence)
2008-05-14 13:35:42,047 - INFO  - Adjusting ejb3example <jta-data-source> to
'My DataSource'
2008-05-14 13:35:42,047 - INFO  - Adjusting ejb3example
<non-jta-data-source> to 'My Unmanaged DataSource'
2008-05-14 13:35:42,057 - INFO  - Loaded Module:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
2008-05-14 13:35:42,057 - INFO  - Assembling app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
2008-05-14 13:35:42,067 - INFO  - Undeploying app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
2008-05-14 13:35:42,097 - ERROR - Unable to deploy collapsed ear in war
/ejb3example: Exception: createApplication.failed
[C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet]:
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
org.apache.openejb.OpenEJBException: createApplication.failed
[C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet]:
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:592)
	at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.start(TomcatWebAppBuilder.java:236)
	at
org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:58)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
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)
	at
org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:454)
	... 17 more
2008-05-14 13:38:26,643 - INFO  - Undeploying app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT
2008-05-14 13:38:26,653 - INFO  - Undeploying app:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServer
2008-05-14 13:38:26,683 - ERROR - Unable to stop web application
/ejb3example: Exception:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
org.apache.openejb.NoSuchApplicationException:
C:\_home\WorkSpace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\OpenEjbServlet
	at
org.apache.openejb.assembler.classic.Assembler.destroyApplication(Assembler.java:599)
	at
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.afterStop(TomcatWebAppBuilder.java:392)
	at
org.apache.openejb.tomcat.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:66)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4579)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
	at org.apache.catalina.core.ContainerBase.stop(ContainerBase.java:1098)
	at org.apache.catalina.core.StandardEngine.stop(StandardEngine.java:448)
	at org.apache.catalina.core.StandardService.stop(StandardService.java:584)
	at org.apache.catalina.core.StandardServer.stop(StandardServer.java:744)
	at org.apache.catalina.startup.Catalina.stop(Catalina.java:628)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:603)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

My persistence.xml:
<persistence version="1.0"
	xmlns="http://java.sun.com/xml/ns/persistence"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
	<persistence-unit name="ejb3example" transaction-type="JTA">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jta-data-source>java:openejb/Connector/My DataSource</jta-data-source>
		<non-jta-data-source>java:openejb/Connector/My Unmanaged
DataSource</non-jta-data-source>
		<properties>
			<property name="hibernate.transaction.manager_lookup_class"
value="org.apache.openejb.hibernate.TransactionManagerLookup" />
			<property name="hibernate.hbm2ddl.auto" value="create-drop" />
			<property name="hibernate.ejb.cfgfile" value="hibernate.cfg.xml" />
		</properties>
	</persistence-unit>
</persistence>

OpenEJB Version = Apache OpenEJB 3.0    build: 20080408-04:13
Tomcat Version = apache-tomcat-6.0.16
Java Version = Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
Operating System Type and Version = Windows XP [Version 5.1.2600]

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.
Can that go well, i do not think so.
But what can i do.
For any suggestions i am very grateful.
Thanks,
Roland
(excuse my awful english)
-- 
View this message in context: http://www.nabble.com/problem-with-hibernate-persistence-provider-tp17230211p17230211.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Mime
View raw message