1 Reply Latest reply on Aug 22, 2014 11:16 AM by rhauch

    Query regarding different marshaller/unmarshaller behavior between JAVA SE And JBOSS environment

    deepak_a

      Hi All,


      We use modeshape(3.7.1.Final) and Infinispan(5.2.1.Final).

      We use it in in JavaSE and JBOSS EAP  environment.

      i.e. we write to the JCR via infinispan using JavaSE and read data from JCR using JBOSS EAP.


      We have a problem that when the data is marshall by the JavaSE side can’t be unmarshall in the JBoss Side and found that StreamCorruptedException is raised,

      for more detail information about the exception please refer to the attachment.

       

      After some research and code debug I found that Infinispan will use JBOSS marshaller to marshall/unmarshall the JCR data.

      The root cause  is the instance of ClassResolver  used in the JBoss marshaller is different at runtime between the JavaSE and JBoss EAP .


      1)If the Infinispan with modeshape running in JBoss environment, the instance of ClassResolver is ModularClassResolver.

      2)and If Infinispan with modeshape running in Java SE environment , the instance of ClassResolver is JbossMarshaller#EmbbedContextClassResolver. 

       

         There are two methods defined in interface of ClassResolver

      1) annotateClass

      2) annotateProxyClass

       

      When the infinispan is running on the JBoss Environment , ModularClassResolver store class name along with its corresponding module identifier.

       

      So my question is whether we can force the Jboss Marshaller to  use the same instance of the ClassResolver whenever infinispan is running on JBOSS or JAVA SE environment?

       

       

      regards

      Deepak.

        • 1. Re: Query regarding different marshaller/unmarshaller behavior between JAVA SE And JBOSS environment
          rhauch

          ModeShape uses Externalizers and has code in the Schematic class to configure Infinispan to use specific externalizer implementations. It's not clear why this behavior is any different in the two environments, because those classes are all part of the ModeShape libraries.


          ModeShape does have an Environment interface, and two different implementations: LocalEnvironment is used in JavaSE and RepositoryService that is part of ModeShape's subsystem for JBoss AS/EAP/Wildfly (depending upon version). One of the methods is to obtain the ClassLoader used for our components, but I don't know how this would relate to Infinispan not being able to find the correct marshallers.

           

          I do think there is a way to configure Infinispan to use a specific class resolver, but I don't know what's the best way to use that in JavaSE. This might be a good question for the Infinispan forums.