exception buried in JAXBUnmarshalTransformer
jbride Apr 9, 2013 1:55 AMHi.
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 :
- 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)
- 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