users@glassfish.java.net

Re: Exception [TOPLINK-7189]

From: Kenneth Clark <kenneth_at_rabiddog.co.za>
Date: Wed, 17 Jan 2007 06:59:24 +0200

Thanks very much for that

Kenneth Clark
Programmer/Analyst

Rabid Dog Laboratories ™
Putting the art back into development

*tel:* +27 11 475 7409
*mobile:* +27 82 500 5090
*e-mail:* kenneth_at_rabiddog.co.za
*website:* http://www.rabiddog.co.za/


Sanjeeb Kumar Sahoo wrote:
> After GlassFish V1 b48, there was an update release made containing
> bug fixes. It's called GlassFish V1 UR1. The final build for this
> release was GlassFish V1 UR1 b14 which is available at:
> https://glassfish.dev.java.net/downloads/v1_ur1-b14.html
> Either use the above build or the latest build from GlassFish V2
> instead of GlassFish V1 b48.
>
> Yes, make the code changes as well.
>
> Thanks,
> Sahoo
>
> Kenneth Clark wrote:
>> I am using Glassfish V1 b48? As far as I understand that is the most
>> recent build. I will have a look at the suggestion you made.
>>
>> I am wondering if this issue has anything to do with the Java update
>> that happened recently on my machine 1.5.9->1.5.10
>>
>> Since this update Glassfish has been all over the place and crashes
>> the machine regularly
>>
>> Thanks very much
>>
>> Kenneth Clark
>> Programmer/Analyst
>>
>> Rabid Dog Laboratories ™
>> Putting the art back into development
>>
>> *tel:* +27 11 475 7409
>> *mobile:* +27 82 500 5090
>> *e-mail:* kenneth_at_rabiddog.co.za
>> *website:* http://www.rabiddog.co.za/
>>
>>
>> Sanjeeb Kumar Sahoo wrote:
>>> Hi,
>>>
>>> Are you using GlassFish V1? It appears to be a bug in that version
>>> of TopLink Essential which was assuming the thread's context class
>>> loader to be an instance of URLClassLoader. This bug has been fixed
>>> in GlassFish V1 UR1 as well as Glassfish V2 [1]. Please use one of
>>> the newer builds and that exception should go away.
>>>
>>> You may also like to revisit your EJB because it is not correctly
>>> using the JPA APIs. Since you are using a static variable to keep a
>>> reference to the EntityManager, the same EntityManager can be called
>>> concurrently by the container and that can lead to runtime errors as
>>> an entity manager may not be thread-safe object. So, I suggest you
>>> change your code like this:
>>>
>>> @Stateless
>>> @WebService(serviceName="CompanyService")
>>> public class CompanyManagerImpl implements CompanyManager {
>>>
>>> // no need to use EntityManagerFactory, use injection to get an EM.
>>> @PersistenceContext(unitName="pu1")
>>> private EntityManager manager;
>>>
>>> ...
>>>
>>>
>>> Thanks,
>>> Sahoo
>>>
>>> [1]
>>> http://fisheye5.cenqua.com/browse/glassfish/entity-persistence/src/java/oracle/toplink/essentials/internal/ejb/cmp3/JavaSECMPInitializer.java?r1=1.13&r2=1.12
>>>
>>>
>>> Kenneth Clark wrote:
>>>> I got some really annoying error here and the stack trace ain't
>>>> very helpful
>>>>
>>>> Exception creating stateless session bean : [{0}]
>>>> java.lang.ExceptionInInitializerError
>>>> at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>>> at
>>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>>
>>>> at
>>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>>
>>>> at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>>> at java.lang.Class.newInstance0(Class.java:350)
>>>> at java.lang.Class.newInstance(Class.java:303)
>>>> at
>>>> com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:492)
>>>>
>>>> at
>>>> com.sun.ejb.containers.StatelessSessionContainer.access$100(StatelessSessionContainer.java:96)
>>>>
>>>> at
>>>> com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:746)
>>>>
>>>> at
>>>> com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:186)
>>>>
>>>> at
>>>> com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:469)
>>>>
>>>> at
>>>> com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:1566)
>>>>
>>>> at
>>>> com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:133)
>>>>
>>>> at $Proxy86.requestCompany(Unknown Source)
>>>> 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:585)
>>>> at com.sun.xml.ws.server.PeptTie._invoke(PeptTie.java:58)
>>>> at
>>>> com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.invokeEndpoint(SOAPMessageDispatcher.java:278)
>>>>
>>>> at
>>>> com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher$SoapInvoker.invoke(SOAPMessageDispatcher.java:586)
>>>>
>>>> at
>>>> com.sun.xml.ws.protocol.soap.server.SOAPMessageDispatcher.receive(SOAPMessageDispatcher.java:145)
>>>>
>>>> at com.sun.xml.ws.server.Tie.handle(Tie.java:88)
>>>> at
>>>> com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:160)
>>>>
>>>> at
>>>> com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:89)
>>>>
>>>> at
>>>> com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:178)
>>>>
>>>> at
>>>> com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:109)
>>>>
>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>>>> at
>>>> com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:100)
>>>>
>>>> at
>>>> org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
>>>>
>>>> at
>>>> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
>>>>
>>>> at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)
>>>> 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:231)
>>>>
>>>> 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)
>>>>
>>>> Caused by: Exception [TOPLINK-7189] (Oracle TopLink Essentials -
>>>> 2006.4 (Build 060412)):
>>>> oracle.toplink.essentials.exceptions.ValidationException
>>>> Exception Description: Cannot create temp classloader from current
>>>> loader: [EJBClassLoader : urlSet = [URLEntry :
>>>> file:/C:/glassfish/domains/domain1/applications/j2ee-modules/PhoenixV2_1/,
>>>> URLEntry :
>>>> file:/C:/glassfish/domains/domain1/generated/ejb/j2ee-modules/PhoenixV2_1/]
>>>>
>>>> doneCalled = false Parent -> EJBClassLoader : urlSet = []
>>>> doneCalled = false Parent -> java.net.URLClassLoader_at_15ac3c9
>>>>
>>>> ]
>>>> at
>>>> oracle.toplink.essentials.exceptions.ValidationException.currentLoaderNotValid(ValidationException.java:1865)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.createTempLoader(JavaSECMPInitializer.java:221)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.createTempLoader(JavaSECMPInitializer.java:210)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:129)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:309)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:335)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.initializeFromMain(JavaSECMPInitializer.java:372)
>>>>
>>>> at
>>>> oracle.toplink.essentials.internal.ejb.cmp3.JavaSECMPInitializer.getJavaSECMPInitializer(JavaSECMPInitializer.java:83)
>>>>
>>>> at
>>>> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.getServerSession(EntityManagerFactoryProvider.java:283)
>>>>
>>>> at
>>>> oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory(EntityManagerFactoryProvider.java:125)
>>>>
>>>> at
>>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
>>>>
>>>> at
>>>> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
>>>>
>>>> at
>>>> za.co.datapro.business.company.manager.CompanyManagerImpl.<clinit>(CompanyManagerImpl.java:49)
>>>>
>>>> ... 48 more
>>>>
>>>>
>>>> the EJB looks like
>>>>
>>>> @Stateless
>>>> @WebService(serviceName="CompanyService")
>>>> public class CompanyManagerImpl implements CompanyManager {
>>>> private final static EntityManagerFactory managerFactory =
>>>> Persistence.createEntityManagerFactory("pu1");
>>>> private final static EntityManager manager =
>>>> managerFactory.createEntityManager();
>>>> private String responseMsg = "";
>>>> private int responseCode = 0;
>>>> private int responseType = 0;
>>>>
>>>> public static class FactoryImpl implements Factory {
>>>> public CompanyManager create(){
>>>> return new CompanyManagerImpl();
>>>> }
>>>> }
>>>>
>>>> private static final Factory defaultFactory = new FactoryImpl();
>>>>
>>>> public CompanyManagerImpl(){}
>>>>
>>>> @WebMethod(operationName="addCompany")
>>>> public CompanyResponse addCompany(CompanyRequest companyRequest){
>>>> }
>>>>
>>>> @WebMethod(operationName="updateCompany")
>>>> public CompanyResponse updateCompany(CompanyRequest companyRequest){
>>>>
>>>> }
>>>>
>>>> @WebMethod(operationName="deleteCompany")
>>>> public CompanyResponse deleteCompany(CompanyRequest companyRequest){
>>>>
>>>> }
>>>>
>>>> public static Factory getDefaultFactory(){
>>>> return defaultFactory;
>>>> }
>>>>
>>>> @WebMethod(operationName="requestCompanies")
>>>> public ListResponse requestCompanies(ListRequest
>>>> companyListRequest){
>>>>
>>>> }
>>>>
>>>> @WebMethod(operationName="requestCompany")
>>>> public CompanyResponse requestCompany(CompanyRequest
>>>> companyRequest){
>>>>
>>>> }
>>>>
>>>> }
>>>>
>>>> Can anyone see anything glaringly obvious as to why I would be
>>>> receiving this error?
>>>>
>>>> Thanks
>>>> --
>>>> Kenneth Clark
>>>> Programmer/Analyst
>>>>
>>>> Rabid Dog Laboratories ™
>>>> Putting the art back into development
>>>>
>>>> *tel:* +27 11 475 7409
>>>> *mobile:* +27 82 500 5090
>>>> *e-mail:* kenneth_at_rabiddog.co.za
>>>> *website:* http://www.rabiddog.co.za/
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>
>