-->
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.  [ 8 posts ] 
Author Message
 Post subject: Hibernate with EJB 3.0 and Sun AS 9.1?
PostPosted: Sat Apr 19, 2008 8:10 am 
Newbie

Joined: Sat Apr 19, 2008 7:58 am
Posts: 14
Hi I am new with hibernate and wanted to check out the EntityManager from Hibernate as I discovered a bug in the Glasfish oracle.toplink EM where it randomly fails to delete an entity from the DB.

So I have all set up and have all the libs put into the AS lib folder as needed. Now upon just running a deploy I alway get this excepiton

[PersistenceUnit qspersistence] Unable to build EntityManagerFactory javax.persistence.PersistenceException: [PersistenceUnit: qspersistence] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149) at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84) at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:898) at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184) at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126) at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:244) at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336)

The following persistence.xml is used and is in place:

<?xml version="1.0" encoding="UTF-8"?>
<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/ ... ce_1_0.xsd">
<persistence-unit name="qspersistence" transaction-type="JTA">
<!-- <provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider> -->
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>jdbc/QS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
</properties>
</persistence-unit>
</persistence>

All Entitys are EJB 3.0 annotated. I dont want to use any ORM as EJB 3.0 Annotations should be enough and the oracle.toplink is creating tables and constraints in the right way. Can hibernate EM do the job? Or am I missing something here?

Huge thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 3:45 am 
Newbie

Joined: Sat Apr 19, 2008 7:58 am
Posts: 14
push...

No one has any idea?


Top
 Profile  
 
 Post subject: sure
PostPosted: Thu Apr 24, 2008 3:54 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
I'm using Hib3 with SAS9.1
Is this the entire stack trace?
can you list the hibernate jars that you placed in your .ear file?
do u have any hibernate.cfg.xml or *.hbm.xml files in your project?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 4:51 am 
Newbie

Joined: Sat Apr 19, 2008 7:58 am
Posts: 14
1. Didnt place any hibernate files in ear as all are in the lib folder of the AS
2. no i dont have any hibernate.cfg.xml or other in the project.. :(


Top
 Profile  
 
 Post subject: more questions
PostPosted: Thu Apr 24, 2008 5:03 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
did you put the hib jars in the AS lib folders? pls list the jars and their location in your AS installation.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 5:05 am 
Newbie

Joined: Sat Apr 19, 2008 7:58 am
Posts: 14
Volume in drive C is System
Volume Serial Number is 44DE-8D58

Directory of C:\j2ee_5_04\lib

04/24/2008 11:04 <DIR> .
04/24/2008 11:04 <DIR> ..
03/20/2008 10:03 69,323 activation.jar
03/20/2008 10:06 <DIR> addons
03/20/2008 10:03 933,534 admin-cli-ee.jar
03/20/2008 10:04 1,208,808 admin-cli.jar
03/20/2008 10:03 <DIR> ant
08/13/2005 15:28 5,667 ant-antlr-1.6.5.jar
03/20/2008 10:03 <DIR> appclient
03/20/2008 10:03 1,769,080 appserv-admin.jar
03/20/2008 10:04 1,392,610 appserv-cmp.jar
03/20/2008 10:04 217,826 appserv-deployment-client.jar
03/20/2008 10:03 175,562 appserv-ee.jar
03/20/2008 10:04 605,694 appserv-ext.jar
03/20/2008 10:04 388,327 appserv-jstl.jar
03/20/2008 10:03 351,378 appserv-jwsacc.jar
03/20/2008 10:03 114,347 appserv-launch.jar
03/20/2008 10:04 15,695,054 appserv-rt.jar
03/20/2008 10:03 2,116,354 appserv-se.jar
03/20/2008 10:04 2,534 appserv-tags.jar
03/20/2008 10:04 379,602 appserv-upgrade.jar
03/20/2008 10:03 378 appserv-ws.jar
03/20/2008 10:03 30,546 appserv.exe
03/20/2008 10:03 30,546 appservAgent.exe
03/20/2008 10:03 26,821 appservAgentService.exe
03/20/2008 10:03 30,546 appservDAS.exe
03/20/2008 10:03 32,394 appservLauncher.exe
03/20/2008 10:04 26,821 appservService.exe
03/20/2008 10:04 237 asadmin-pause.bat
03/17/2005 16:05 16,777 asm-attrs.jar
03/17/2005 15:32 26,360 asm.jar
03/20/2008 10:03 24,576 asnss.dll
01/19/2007 09:04 608,376 c3p0-0.9.1.jar
03/20/2008 10:04 238 certutil.bat
03/20/2008 10:04 94,208 certutil.exe
12/02/2005 11:28 282,338 cglib-2.1.3.jar
03/20/2008 10:04 41,863 com-sun-commons-launcher.jar
03/20/2008 10:04 26,896 com-sun-commons-logging.jar
06/30/2004 04:59 175,426 commons-collections-2.1.1.jar
07/04/2004 04:49 38,015 commons-logging-1.0.4.jar
06/03/2004 11:31 171,071 concurrent-1.3.2.jar
03/20/2008 10:04 247,695 dbschema.jar
03/20/2008 10:04 <DIR> deployment
08/13/2005 15:28 313,898 dom4j-1.6.1.jar
03/20/2008 10:04 <DIR> dtds
11/03/2006 13:05 208,048 ehcache-1.2.3.jar
04/19/2008 12:05 52,847 ejb3-persistence.jar
03/20/2008 10:04 <DIR> endorsed
04/19/2008 12:05 280,196 hibernate-annotations.jar
04/19/2008 12:05 66,426 hibernate-commons-annotations.jar
03/14/2008 20:07 118,764 hibernate-entitymanager.jar
02/06/2008 21:31 2,274,768 hibernate3.jar
03/20/2008 10:04 <DIR> install
03/20/2008 10:04 6,665 j2ee-svc.jar
03/20/2008 10:03 362 j2ee.jar
03/20/2008 10:04 1,115,243 javaee.jar
11/16/2006 13:46 471,005 javassist.jar
03/20/2008 10:03 <DIR> jdic
03/20/2008 10:04 1,161,974 jdmkrt.jar
03/20/2008 10:04 170,610 jesmf-plugin.jar
03/20/2008 10:03 557,529 jhall.jar
03/20/2008 10:03 21,213 jmac-api.jar
03/20/2008 10:04 524,764 jmxremote_optional.jar
03/20/2008 10:04 1,215,271 jsf-impl.jar
03/20/2008 10:04 22,621 jvminfoutil.dll
03/20/2008 10:03 1,735,958 jxta.jar
03/20/2008 10:04 326 killserv.bat
03/20/2008 10:04 3,273 launcher.properties
03/20/2008 10:04 6,593 launcher.xml
03/20/2008 10:04 4,770 LauncherBootstrap.class
04/24/2008 11:04 0 lib.txt
08/13/2005 15:28 350,627 log4j-1.2.11.jar
03/20/2008 10:04 410,478 mail.jar
03/05/2008 18:27 703,265 mysql-connector-java-5.1.6-bin.jar
03/20/2008 10:04 8,811 package-appclient.xml
03/20/2008 10:04 330 pk12util.bat
03/20/2008 10:04 61,440 pk12util.exe
03/20/2008 10:04 3,942 PLBootstrap.class
03/20/2008 10:04 2,080 processLauncher.properties
03/20/2008 10:04 14,865 processLauncher.xml
03/20/2008 10:06 <DIR> registration
03/20/2008 10:04 <DIR> schemas
03/20/2008 10:03 203,315 shoal-gms.jar
03/20/2008 10:04 244 start-appserv.bat
03/20/2008 10:04 50,653 sun-appserv-ant.jar
03/20/2008 10:04 <DIR> SUNWjdmk
03/20/2008 10:04 9,780 toplink-essentials-agent.jar
03/20/2008 10:04 2,462,109 toplink-essentials.jar
03/20/2008 10:04 <DIR> upgrade
03/20/2008 10:04 <DIR> verifier
03/20/2008 10:04 11,212,289 webservices-rt.jar
03/20/2008 10:04 3,628,999 webservices-tools.jar
77 File(s) 56,814,179 bytes
15 Dir(s) 1,138,524,160 bytes free

More stack trace:

[PersistenceUnit qspersistence] Unable to build EntityManagerFactory javax.persistence.PersistenceException: [PersistenceUnit: qspersistence] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:132) at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:149) at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84) at com.sun.enterprise.server.AbstractLoader.loadPersistenceUnits(AbstractLoader.java:898) at com.sun.enterprise.server.ApplicationLoader.doLoad(ApplicationLoader.java:184) at com.sun.enterprise.server.TomcatApplicationLoader.doLoad(TomcatApplicationLoader.java:126) at com.sun.enterprise.server.AbstractLoader.load(AbstractLoader.java:244) at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:336) at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:210) at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:645) at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:928) at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:912) at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:461) at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:176) at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308) at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:226) at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298) at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132) at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108) at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:919) at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:591) at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:635) at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:744) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:375) at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:358) at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:464) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90) at $Proxy1.invoke(Unknown Source) at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304) at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:174) at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:69) at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:155) at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:122) at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:193) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290) at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:116) Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:66) at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:75) at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:43) at org.hibernate.loader.entity.EntityLoader.<init>(EntityLoader.java:33) at org.hibernate.loader.entity.BatchingEntityLoader.createBatchingEntityLoader(BatchingEntityLoader.java:103) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1752) at org.hibernate.persister.entity.AbstractEntityPersister.createEntityLoader(AbstractEntityPersister.java:1756) at org.hibernate.persister.entity.AbstractEntityPersister.createLoaders(AbstractEntityPersister.java:2989) at org.hibernate.persister.entity.AbstractEntityPersister.postInstantiate(AbstractEntityPersister.java:2982) at org.hibernate.persister.entity.SingleTableEntityPersister.postInstantiate(SingleTableEntityPersister.java:690) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:290) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1300) at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:859) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669) ... 71 more


Top
 Profile  
 
 Post subject: question
PostPosted: Thu Apr 24, 2008 7:40 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
Did you try to find out what the exception cause means:
Caused by: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags at org.hibernate.loader.BasicLoader.postInstantiate(BasicLoader.java:66)
see for example:
http://forum.java.sun.com/thread.jspa?threadID=5270246&messageID=10166648
But you can google for more, I guess.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 24, 2008 7:42 am 
Newbie

Joined: Sat Apr 19, 2008 7:58 am
Posts: 14
Thanks. Was already digging into that.
Multiple bags go back to eager fetching on aggregation with LinkList:

A 1:n B 1:n C
if u have eager fetch on B it fails. Try to figure out why...


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