3 Replies Latest reply on Apr 9, 2013 8:43 PM by kcbabo

    exception buried in JAXBUnmarshalTransformer

    jbride

      Hi.

         i came across a mistake in a SY 0.8.0.FINAL based app that contains a bean component exposed by a SOAP gateway.

         In particular,  a mis-match was introduced between target namespace in the app's  wsdl and the target namespace in the app's  jaxb generated classes.

       

         This root exception is getting caught and  re-thrown as a SwitchyardException in org.switchyard.transform.jaxb.internal.JAXBUnmarshalTransformer.

         The SwitchyardException is logged however the root exception is lost .... so the only way to identify the details of the problem is to step through the SY code with a debugger.

       

        This scenario can be reproduced in SY 0.8.0.FINAL using the transform-jaxb quickstart.

         the following two modificaitons are necessary :

      1. in src/main/resources/wsdl/OrderService.wsdl,   change every occurrance of "urn:switchyard-quickstart:transform-jaxb:1.0"   to   "rn:switchyard-quickstart:transform-jaxb:1.0"       ( remove the 'u' from the prefix)
      2. in src/main/resources/META-INF/switchyard.xml, change every occurrance of "urn:switchyard-quickstart:transform-jaxb:1.0"   in the transforms  to  "rn:switchyard-quickstart:transform-jaxb:1.0"   (remove the 'u' from the prefix)

       

      what currently does get logged is the following :

       

      Application {rn:switchyard-quickstart:transform-jaxb:1.0}OrderService#{rn:switchyard-quickstart:transform-jaxb:1.0}submitOrder has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault:
       org.switchyard.exception.SwitchYardException: Failed to unmarshall for 'java:org.switchyard.quickstarts.transform.jaxb.Order'.
      

       

      the above error message does at least give a hint that there is a problem unmarshalling to the java domain model.

      however, the following root exception caught in line 86 of JAXBUnmarshalTransformer.java  reveals the exact problem :

       

       

      javax.xml.bind.UnmarshalException: unexpected element (uri:"rn:switchyard-quickstart:transform-jaxb:1.0", local:"order")
      Expected elements are
          <{urn:switchyard-quickstart:transform-jaxb:1.0}order>,
          <{urn:switchyard-quickstart:transform-jaxb:1.0}orderAck>
      
      

       

       

      In my case, seeing the exact details of the problem in the debugger was very helpful in troubleshooting the customer's SY app where i wasn't particular familiar with their schemas, wsdl's and namespaces.

       

      Jeff

        • 1. Re: exception buried in JAXBUnmarshalTransformer
          kcbabo

          Hey Jeff,

           

          You can actually get that level of detail if you switch to DEBUG level logging.  The reason it's not logged higher is that the error is propagated back to the invoker, so the log output is more of an informational/debug tool.  I did notice that the error going back in the SOAP fault is just the top-level error message.  We could include lower level details, but the issue there is how much of the internal implementation do you want to expose in the SOAP Fault.  At this point, a custom composer could be used to customize the level of detail in the returned fault.

           

          We are continuously trying to make it easier to customize error handling and make errors more visible when needed, so any suggestions or feedback you have are welcome.

           

          cheers,

          keith

          • 2. Re: exception buried in JAXBUnmarshalTransformer
            jbride

            Thanks Keith.  i now see that org.switchyard.bus.camel.audit.FaultProcessor does log the root exception.  Excellent.

             

            i did actually try to set logging to DEBUG last night but was getting this exception when doing so in SY 0.8.0.FINAL :

             

             

            07:59:15,598 WARN  [org.apache.camel.processor.UnitOfWorkProcessor] (http--127.0.0.1-8080-1) Caught unhandled exception while processing ExchangeId: ID-zareason-53740-1365515946277-0-2: java.lang.NoClassDefFoundError: org/switchyard/common/lang/Strings
                      at org.switchyard.bus.camel.audit.FaultProcessor.dumpExceptionContents(FaultProcessor.java:110) [switchyard-bus-camel-0.8.0.Final.jar:0.8.0.Final]
                      at org.switchyard.bus.camel.audit.FaultProcessor.handle(FaultProcessor.java:85) [switchyard-bus-camel-0.8.0.Final.jar:0.8.0.Final]
                      at org.switchyard.bus.camel.audit.FaultProcessor$1.done(FaultProcessor.java:67) [switchyard-bus-camel-0.8.0.Final.jar:0.8.0.Final]
            
            

             

            unfortunately i did not pursue trying to solve this issue at the time ...... i just kept logging at INFO not realizing the value of FaultProcessor when set to DEBUG.

             

            not sure if this NoClassDefFoundError is unique to my environment or not  (i'm using switchyard-as7.0.8.Final.zip ) ...... but to correct the issue, i've added the following dependency to org/switchyard/bus/camel/main/module.xml

             

             

            <module name="org.switchyard.common"/>
            
            • 3. Re: exception buried in JAXBUnmarshalTransformer
              kcbabo

              Jeff,


              Can you send me a complete application that I can deploy to reproduce NoClassDefFoundError?  I've tried a couple things here to reproduce and I'm not able to.  I suspect it's just a matter of a specific app config and error will produce this situation.

               

              thanks,

              keith