2 Replies Latest reply on Feb 25, 2009 5:13 AM by logoff

    problem with esb + xstream

    logoff

      Hi all,

      I'm developing a service and I have an issue serializing/deserializing my own objects. I'm using JBoss 4.2.2.GA + JBoss ESB server 4.4.GA. For serializing tasks, I'm using XStream 1.2.2 provided with the server.

      After receiving an ESB message from the client stub, the server stub fails with an java.lang.ClassCastException when tries to cast my own class with an (MyOwnClass myOwnObject = (MyOwnClass) message.getBody().get("myOwnObject"). If I equal it to Object, it works. When I execute an myOwnObjectNotCasted.getClass(), I obtain the real name of the class, not Object or another one. If I execute System.out.println(myOwnObjectNotCasted), I obtain the override toString result of my own class. If a capture the xml serialized it seems to be correct.

      The trace:

      12:44:16,833 WARN [ActionProcessingPipeline] Unexpected exception caught while processing the action pipeline: header: [ To: InVMEpr [ PortReference < <wsa:Address invm://686476697065722d42616e6477696474684f6e44656d616e646372656174655265736572766174696f6e/false?false#10000/>, <wsa:ReferenceProperties jbossesb:passByValue : false/>, <wsa:ReferenceProperties jbossesb:type : urn:jboss/esb/epr/type/invm/> > ] ReplyTo: InVMEpr [ PortReference < <wsa:Address invm://thread-200/>, <wsa:ReferenceProperties jbossesb:passByValue : false/> > ] ]
      java.lang.ClassCastException: myPackage.myOwnClass
      etc...


      It is so strange, because it seems that it is the correct class, but the exception appears... can somebody help me?

      Tank you very much!!

        • 1. Re: problem with esb + xstream
          tfennelly

          I'd guess it's to do with InVM, pass by reference (Vs pass by value) and scoped deployments (i.e. classes loaded by different classloaders).

          Try turning on pas by value:

          <service category="ServiceCat" name="ServiceName" description="Service Desc">
           <property name="inVMPassByValue" value="true" />
          
           <actions>
           ... cut ...
           </actions>
          </service>
          


          • 2. Re: problem with esb + xstream
            logoff

            Thank you very much tfennelly!!! It works for me!! You solved my problem very fast, thank you!!!