users@glassfish.java.net

Re: Classloading Error for JPA Implementation

From: <glassfish_at_javadesktop.org>
Date: Wed, 21 Mar 2007 09:07:18 PST

Hi Marina,

I tried Glassfish V2 Build 39 and the jpa class loading problem did go away. There were few other non-jpa issues that I encountered with V2 that were perfectly fine in V1. I don't want to get into those issues since they are not a topic of this thread. In addition, we can't use V2 yet since there is no GA release for our production environment.

I did find a V1 workaround for the jpa class loading issue by removing the toplink-essentials.jar and toplink-essentials-agent.jar from the glassfish/lib directory. Hibernate JPA loads everytime now, but I encounter another issue when I undeploy and then deploy my webapp. Glassfish couldn't create the EntityManagerFactory during the undeploy/deploy process. The stack trace is below. I have to restart the instance everytime I undeploy and deploy the webapp for it to create EntityManagerFactory correctly.

Any idea why?

thanks.

[#|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 com.sun.My.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
[Message sent by forum member 'tmv' (tmv)]

http://forums.java.net/jive/thread.jspa?messageID=209248