We are running into a problem using JBoss 4.0.2 and Hibernate 3, and we're out of ideas at the moment. Let me describe our design: we have a core EAR file which contains some core classes, used by all of our applications. So far, all the applications used JDBC to access the database, but we are now switching to Hibernate. Our first app that uses HAR works perfectly when deployed by itself (+ the core ear file). But as soon as we deploy another EAR, we get this error, at the point when HAR is trying to "lazily" initialize an object:
15:39:53,994 ERROR [LogInterceptor] Unexpected Error in method: public abstract java.util.List org.aim.MOS.interfaces.Rave.getFrontpageStories(java.lang.String,int,int) throws java.rmi.RemoteException java.lang.NoClassDefFoundError: net/sf/cglib/proxy/MethodProxy at org.hibernate.proxy.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:137) at org.aim.har.Story$$EnhancerByCGLIB$$552b2aeb.getUrl(<generated>) at org.aim.MOS.BBL.StoryBBL.convertStoryToDomain(StoryBBL.java:64) at org.aim.MOS.BBL.StoryBBL.getFrontpageStories(StoryBBL.java:324) at org.aim.MOS.ejb.RaveBean.getFrontpageStories(RaveBean.java:237) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ...
We have already tried the following:
1) Googled this error message. All we seem to get is a similar error that happens when the session is closed, and THEN the app tries to initialize an object.
2) We changed all the stuff in the *.hbm.xml files to lazy="false". Did not help.
3) There is one shared class in the core, we though it may be causing some kind of conflict. So we took it out of our core and made a new, renamed one that's specific to the project. Did not help either.
A bit more detail on what happens: Hibernate makes the first call, it executes the query fine. The objects that come back contain a reference to another object (we internally call those "2nd level objects", perhaps there's a proper term for this?). We manually get those if we execute another query, but that sort of defeats the purpose.
So this is our problem in a nutshell. Has anyone run into something like this before? Any ideas on how to proceed or what kind of settings to look for? Any feedback would be greatly appreciated.