persistence@glassfish.java.net

Re: NullPointerException javaagent WebSphere 6.1

From: Andrei Ilitchev <andrei.ilitchev_at_oracle.com>
Date: Fri, 27 Oct 2006 13:11:36 -0400

Don,

You should not use toplink-essentials-agent.jar with nan application
server - javaagent should only be used in a standalone JSE case.

However, in JSE case with application server, PU can be redeployed - just
make sure that all emFactories using the previous deployment are closed:

  deploy the app;
  // the first factory associated with PU predeploys it: load entity
classes, creates TopLink session.
  factory1 = createEntityManagerFactory("my", prop);
...
  factory2 = createEntityManagerFactory("my", prop);
...
  factory2.close();
...
  // closing the last factory associated with PU undeploys it - TopLink
session logged out, discarded.
  factory1.close();
  redeploy the app.
  // the first factory associated with PU predeploys it: load entity
classes, creates TopLink session.
  factoryNew = createEntityManagerFactory("my", prop);

Thanks,

Andrei
----- Original Message -----
From: "Marina Vatkina" <Marina.Vatkina_at_Sun.COM>
To: <persistence_at_glassfish.dev.java.net>
Sent: Friday, October 27, 2006 12:42 PM
Subject: Re: NullPointerException javaagent WebSphere 6.1


> Don,
>
> One more bug that can affect you is this:
> https://glassfish.dev.java.net/issues/show_bug.cgi?id=857
>
> The problem with your case is that in Java SE mode the code expects that
> it can find all PUs up-front. If you deploy a new application after at
> least 1 app with a PU has been already loaded, that new app won't be
> processed correctly. Server restart should solve this problem.
>
> thanks,
> -marina
>
> DonBrady wrote:
>> Definitely it exists because it works ok 98% of the time if I omit the
>> javaagent.
>>
>> But Sahoo suggests that it may not be accessible on the classpath when
>> javagent is used.
>>
>> I will try some experiments with classpaths and report back...
>>
>> Thanks to both of you!
>>
>> Don
>>
>>
>> Wonseok Kim-2 wrote:
>>
>>>Hi, Don
>>>Can you check if the persistence unit name provided by
>>>createEntityManagerFactory() exists in META-INF/persistence.xml?
>>>
>>>This occurs if it could not find the persistence unit of the given
>>>name(issue 854).
>>>https://glassfish.dev.java.net/issues/show_bug.cgi?id=854
>>>
>>>Thanks
>>>-Wonseok
>>>
>>>On 10/27/06, DonBrady <dbrady_at_pobox.com> wrote:
>>>
>>>>
>>>>I am using toplink-essentials under WebSphere 6.1 (which is based on
>>>>Java
>>>>5)
>>>>
>>>>If I try to use the the toplink-essentials-agent.jar via the jvm
>>>>javaagent
>>>>argument that starts WebSphere, I get the following exception:
>>>>
>>>>java.lang.NullPointerException
>>>> at
>>>>
>>>>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.createEntityManagerFactory
>>>>(EntityManagerFactoryProvider.java:120)
>>>> at
>>>>javax.persistence.Persistence.createEntityManagerFactory(Persistence.java
>>>>:83)
>>>> at
>>>>com.ncfbins.services.mship.implementations.FetchHRController.fetchhr(
>>>>FetchHRController.java:94)
>>>> at
>>>>
>>>>com.ncfbins.services.mship.implementations.MembershipImplementation.fetchhr
>>>>(MembershipImplementation.java:141)
>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>> at
>>>>sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
>>>>:64)
>>>> at
>>>>sun.reflect.DelegatingMethodAccessorImpl.invoke(
>>>>DelegatingMethodAccessorImpl.java:43)
>>>> at java.lang.reflect.Method.invoke(Method.java:615)
>>>> at
>>>>com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeMethod
>>>>(JavaDispatcher.java:178)
>>>> at
>>>>com.ibm.ws.webservices.dispatchers.ejb.J2ee14EJBDispatcher.invokeMethod(
>>>>J2ee14EJBDispatcher.java:173)
>>>> at
>>>>
>>>>com.ibm.ws.webservices.engine.dispatchers.java.JavaDispatcher.invokeOperation
>>>>(JavaDispatcher.java:141)
>>>> at
>>>>
>>>>com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processRequestResponse
>>>>(SoapRPCProcessor.java:447)
>>>> at
>>>>com.ibm.ws.webservices.engine.dispatchers.SoapRPCProcessor.processMessage(
>>>>SoapRPCProcessor.java:412)
>>>> at
>>>>com.ibm.ws.webservices.engine.dispatchers.BasicDispatcher.processMessage(
>>>>BasicDispatcher.java:134)
>>>> at
>>>>com.ibm.ws.webservices.dispatchers.ejb.J2ee14EJBDispatcher.invoke(
>>>>J2ee14EJBDispatcher.java:154)
>>>> ... 31 more
>>>>
>>>>I realixe that it is not essential to specify the javaagent.
>>>>
>>>>However, even when I leave it off, I sometimes get the same exception.
>>>>
>>>>Any suggestions would be appreciated....
>>>>
>>>>Thanks,
>>>>
>>>>Don
>>>>--
>>>>View this message in context:
>>>>http://www.nabble.com/NullPointerException-javaagent-WebSphere-6.1-tf2519877.html#a7028182
>>>>Sent from the java.net - glassfish persistence mailing list archive at
>>>>Nabble.com.
>>>>
>>>
>>>
>>
>