I'm not sure why 8277 appears in this case, but it might be related to the order of loading. Anyway, for now it can be ignored. Some more details:
With the hibernate jars in glassfish domain lib. The application classes appear to be loaded by 2 class loaders:
EarClassLoader1 > DelegatingClassLoader1 > EarLibClassLoader1 > DelegatingClassLoader1 > URLClassLoader > APIClassLoader > sun.misc.Launcher$ExtClassLoader
and
org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader with no parents.
However when it gets to the first em.persist in the application and tries to set the id, the Field is in EarClassLoader1 and the class of the object to persist is in
EarClassLoader2 > DelegatingClassLoader2 > EarLibClassLoader2 > DelegatingClassLoader2 > URLClassLoader > APIClassLoader > sun.misc.Launcher$ExtClassLoader
I have no idea where this second class loader structure comes from since the debugger never shows it loading the class. EarClassLoader1 is for the entire ear and EarClassLoader2 only for jar
With hibernate jars in the ear lib, the error changes to org.hibernate.id.MultipleHiLoPerTableGenerator cannot be cast to org.hibernate.id.IdentifierGenerator with MultipleHiLoPerTableGenerator in EarLibClassLoader1 and IdentifierGenerator in EarLibClassLoader2.
Since a hibernate class loader does not appear anywhere in the stack when the error occurs, it looks like a Glassfish problem. Will investigate some more.
|