-->
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.  [ 7 posts ] 
Author Message
 Post subject: EntityManagerFactory creation failed when webapp redeployed
PostPosted: Thu Mar 22, 2007 3:54 am 
Newbie

Joined: Thu Mar 22, 2007 3:03 am
Posts: 5
Hi,

I'm using Hibernate JPA 3.2.1 with Glassfish V1. When I undeploy and deploy a new version of the webapp I got the error below. I have to restart the server instance after each re-deployment of the web application for EntityManagerFactory to be created properly.

Any idea why?

thanks.


Quote:
[#|2007-03-20T17:53:45.482-0700|INFO|sun-appserver-pe9.0|javax.enterprise.system.stream.out|_ThreadID=16;_ThreadName=Thread
-49;|17:53:45,478 FATAL MyEntityManagerFactory: Failed to create EntityManagerFactory for persistence-unit=MyService
javax.persistence.PersistenceException: java.lang.NullPointerException
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:252)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at test.common.service.MyEntityManagerFactory.<clinit>(MyEntityManagerFactory.java:28)
at test.common.service.ServiceFactory.close(ServiceFactory.java:40)
at test.mapping.web.controller.MyServletContextListener.contextInitialized(MyServletContextListener.java:2
2)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:662)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1479)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1143)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:171)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:275)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:
954)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.ja
va:296)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:213)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:815)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
at com.sun.enterprise.deployment.client.DeploymentClientUtils.startApplication(DeploymentClientUtils.java:133)
at com.sun.enterprise.deployment.client.DeployAction.run(DeployAction.java:517)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:199)
... 49 more


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 10:40 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Apaprently Glassfish mess up with the thread current class loader on redeployment

Here is the culprit line
Code:
         Enumeration<URL> xmls = Thread.currentThread()
               .getContextClassLoader()
               .getResources( "META-INF/persistence.xml" );

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 10:42 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
PS i seems you don't use the Java EE / JPA integration though
Are you creating your own EMF in your code (using Perssitence.createEMF)

PS: it should not fail either

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 22, 2007 12:57 pm 
Newbie

Joined: Thu Mar 22, 2007 3:03 am
Posts: 5
Yes, I'm using application-managed entity managers. The service layer uses MyEntityManagerFactory to obtain EntityManagers. The line below is where I created the javax.persistence.EntityManagerFactory in MyEntityManagerFactory .

private static EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 04, 2007 6:58 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 7:53 am
Posts: 27
tmw, do you have any updates on this? I have the very same problem on glassfish v2-b33 and b41 as well with Hibernate EntityManager.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 12, 2007 8:42 pm 
Newbie

Joined: Thu Mar 22, 2007 3:03 am
Posts: 5
dyn, I don't have a resolution for this yet. I'm restarting the server instance every time I redeploy. I posted the same issue over at the glassfish forum, but haven't got a real resolution.

http://forums.java.net/jive/message.jsp ... eID=209670

Maybe you should comment on the link above or create a new thread at the glassfish forum to rejuvenate this issue.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 13, 2007 3:36 am 
Beginner
Beginner

Joined: Wed Aug 27, 2003 7:53 am
Posts: 27
Okay. I'm trying to track down this issue with some other glassfish users/devs. You can see the according thread here: http://forums.java.net/jive/message.jsp ... eID=212150


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