Sorry for the delay. I had to leave work before I could answer you yesterday. :)
So, the debugging turned out to show something really strange. This piece of code I'm debugging, inside Ejb3Configuration.class:
Class interceptor = classForName( interceptorName );
cfg.setInterceptor( (Interceptor) interceptor.newInstance() );
According to the stack trace, I get a ClassCastException in line two. As if my Hibernate interceptor does not implement the "org.hibernate.Interceptor" interface, which it does. Like I said before, I have two EAR's being deployed, and in only one of them I have this custom Interceptor. Here's the output from the debug:
//Ejb3Configuration classloader
this.getClass().getClassLoader()
(org.jboss.classloader.spi.base.BaseClassLoader) BaseClassLoader@ac97e2{vfsfile:/Users/rodrigouchoa/Java/jboss-5.1.0-dpf.GA/server/default/deploy/corporativo-packaging.ear/}
//My custom interceptor classloader (its different)
interceptor.getClassLoader()
(org.jboss.classloader.spi.base.BaseClassLoader) BaseClassLoader@40bd2e{vfsfile:/Users/rodrigouchoa/Java/jboss-5.1.0-dpf.GA/server/default/deploy/sinpi-packaging.ear/}
//The hibernate classloader (same as the first one)
org.hibernate.Interceptor.class.getClassLoader()
(org.jboss.classloader.spi.base.BaseClassLoader) BaseClassLoader@ac97e2{vfsfile:/Users/rodrigouchoa/Java/jboss-5.1.0-dpf.GA/server/default/deploy/corporativo-packaging.ear/}
It seems that my custom interceptor is coming from the right classloader, inside the EAR it belongs to. But the Ejb3Configuration.class is running inside the other EAR's classloader! The first and last output are from "corporativo-packaging.ear", and the middle one is from "sinpi-packaging.ear" . How can I isolate these two EARs?
The java2ParentDelegation seems to be working okay. The problem is isolating one EAR from the other.