Hi
> It looks like I added the jars incorrectly. I have corrected what I did, but
> didn't use your exact instructions because I was afraid I would cause
> problems with the server classpath due to possibly overriding some of the
> server's classes with unmatching versions.
This is the right choice. Instead of polluting the AS classloader namespace, it
makes sense to add the hibernate jars at the common classloader level.
> Instead, I added the hibernate jars to the GF Common Classloader by adding
> the jars to the domain-dir/lib directory. As described in the Classloaders
> chapter of the GF Developer's Guide, the Common Classloader is a lower
> priority classloader than the System classloader.
However this does not seem to work, because the application classloader or the
common classloader does not seem to be employed during class deserialization.
The classloader used to load the hibernate entity manager seems to be an
ASURLClassLoader, (the classloader used to construct the shared chain).
I think this is because ObjectInputStream's readObject internally uses the
ObjectInputStream.latestUserDefinedLoader() to load the class. The last non-null
classloader in the execution stack would be the classloader that loaded the
statefulsessioncontainer [ie the shared chain] and hence we have this issue.
We might need to set the application classloader as the classloader to load the
entity manager if we need to support usecases where the persistence provider is
bundled with the app.
I am not a persistence/SFSB expert and so would let Marina/Mahesh comment on
this. Thanks.
> Caused by: java.lang.ClassNotFoundException: org.hibernate.ejb.EntityManagerImpl
> at
com.sun.appserv.server.util.ASURLClassLoader.loadClass(ASURLClassLoader.java:129)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:247)
> at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:604)
> at
java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1575)
> at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
> at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
> at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
> at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
> at
com.sun.ejb.containers.StatefulSessionContainer.repopulateEEMMapsInContext(StatefulSessionContainer.java:2133)
Thanks
--Siva.
glassfish_at_javadesktop.org wrote:
> It looks like I added the jars incorrectly. I have corrected what I did, but didn't use your exact instructions because I was afraid I would cause problems with the server classpath due to possibly overriding some of the server's classes with unmatching versions.
>
> Instead, I added the hibernate jars to the GF Common Classloader by adding the jars to the domain-dir/lib directory. As described in the Classloaders chapter of the GF Developer's Guide, the Common Classloader is a lower priority classloader than the System classloader.
>
> Unfortunately, I'm still getting errors that appear related to this problem. Following is a stack trace: (Notice the errors seem to come spaced around 4-5 minutes apart)
>
> Creating ProductSearchBean|#]