[jboss-as7-dev] JBoss Modules & object serialization

Jeff Mesnil jmesnil at redhat.com
Thu Jul 26 06:12:32 EDT 2012


I'm working on a messaging issue[1] where an user can not deserialize a JMS ObjectMessage that contains an org.w3c.dom.Document 
object (an instance of org.apache.xerces.dom.DocumentImpl loaded from module "org.apache.xerces:main").

HornetQ is not able to deserialize the document object and fails with a CNFE:

java.lang.ClassNotFoundException: org.apache.xerces.dom.DocumentImpl from [Module "org.hornetq:main" from local module 
loader @23aa0933 (roots: 
/home/jmesnil/Developer/jboss-as/testsuite/integration/smoke/../../../build/target/jboss-as-7.2.0.Alpha1-SNAPSHOT/modules)]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

Doing some debugging, it appears that HornetQ is not able to find the class in the TCCL (it then tries to resolve it with its 
own classloader, hence the exception above)

Trying to understand the root cause, I have a simple test[2] that creates a DOM document inside a Servlet, serialize it and 
unserialize it.
The test fails when I deserialize it with a CNFE from the TCCL:

java.lang.ClassNotFoundException: org.apache.xerces.dom.DocumentImpl from [Module 
"deployment.objectmessage.ear.objectmessage.war:main" from Service Module Loader]
         at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
         at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
         at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
         at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
         at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
         at java.lang.Class.forName0(Native Method)

I was expecting this test to succeed. Is there a reason why I could not deserialize a class in the same context that I have 
serialized it?

Thanks,
jeff

[1] https://issues.jboss.org/browse/AS7-1271
[2] 
https://github.com/jmesnil/jboss-as/blob/AS7-1271_ObjectMessage_Classloader_violation/testsuite/integration/smoke/src/test/java/org/jboss/as/test/smoke/jms/objectmessage/DocumentServlet.java#L57

-- 
Jeff Mesnil
JBoss, a division of Red Hat
http://jmesnil.net/


More information about the jboss-as7-dev mailing list