Hi,
I have a webapp packaged as .war and used Hibernate JPA instead of TopLink. All the required Hibernate .jars are in the WEB-INF/lib directory.
According to the url below, I set <class-loader delegate="false"/> to have Glassfish followed the Servlet specification by loading the jars in WEB-INF/lib.
My application runs fine when Glassfish loads up the Hibernate JPA implementation. I got the error below, when it loaded up the Toplink implementation which I didn't want.
I don't know how Glassfish decides which JPA implementation to load because during a server restart, it will randomly choose one over another. If I get lucky when Glassfish obeys the class-loader tag, then my application will work fine, else I get the error below.
https://glassfish.dev.java.net/javaee5/docs/DG/beade.html
"The Servlet specification recommends that the Web Classloader look in the local class loader before delegating to its parent. You can make the Web Classloader follow the delegation inversion model in the Servlet specification by setting delegate="false" in the class-loader element of the sun-web.xml file. It's safe to do this only for a web module that does not interact with any other modules"
I experienced this issue in both of these versions:
Solaris: Sun Java System Application Server Platform Edition 9.0_01 (build b14)
Windows: Sun Java System Application Server Platform Edition 9.0_01 (build b02-p01)
15:46:48,763 FATAL MyEntityManagerFactory: Failed to create EntityManagerFactory for persistence-unit=MyService
java.lang.NullPointerException
at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.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.common.web.filter.MyServiceExtendedPersistenceContextFilter.doFilter(MyServiceExtendedPersistenceContextFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at test.common.web.filter.SessionExpirationFilter.doFilter(SessionExpirationFilter.java:48)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
|#]
[Message sent by forum member 'tmv' (tmv)]
http://forums.java.net/jive/thread.jspa?messageID=208822