You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alexander Lomov <al...@gmail.com> on 2014/01/27 19:23:43 UTC

NPE when unmarshaling Service-Specific Fault

Hi!
I'm getting an NPE while CXF client tries to unmarshal service-specific
fault. Here I write the circumstances down.
I have a web service client, the code is generated with the maven
cxf-codegen-plugin:wsdl2java goal using wsdl-first approach.
CXF client endpoint is wired up by Apache Camel CXF component in an Aries
Blueprint container that runs in Apache Karaf in Equinox.
I have a fault that's defined the next way.
The exception:



The fault bean:

These classes reside in a separate OSGi bundle, packages are imported by the
bundle that hosts the SEI and the Blueprint endpoint definition. I've tried
to move the exception class to the blueprint bundle but it made no effect.

The problem is when the server replies with the LogicalFault the CXF client
endpoint tries to build a Java exception object
(com.somewhat.types.exceptions.LogicalFault) and fails with an NPE.
I've pin-pointed a certain piece of code where it happens. It all happens in
the /ClientFaultConverter/ class, in the /processFaultDetail(Fault fault,
Message msg)/. What happens is:
The runtime gets a /BindingOperationInfo/ instance:
 and it's not null,
checks whether it's /unwrapped/:  ant it isn't so no wrapped operation is
fetched.
Then it iterates over known /FaultInfo/s:  and finds the exact one that hold
meta for /{urn:somewhat:types}LogicalFault/ assigning it to a /faultWanted/
variable.
then it tries to create a Java object that's mapped to the SOAP fault
<detail> element:

and the /e/ is an instance of /com.somewhat.types.LogicalFault/ (doesn't
extend Exception class).
The runtime checks if the /e/ variable is an /Exception/ instance, and it
appears it isn't:  
Since it's not and Exception instance, it tries to get the proper class that
extends /Exception/ class from the /FaultInfo/ meta:
 and *suddenly* the /exClass/ variable is *null* and the next statement ends
up throwing NPE: 
It's surprising that *all* FaultInfo instance properties such as /delegate/
and /propertyMap/ are *null*.
Have you ever faced similar problems? How and when are those /delegate/ and
/propertyMap/ filled with Fault meta under the normal circumstances?
Any advice is appreciated! Thank you in advance!

P.S. I've seen the https://issues.apache.org/jira/browse/CXF-2555 issue. My
case is not the same as I can figure out.




--
View this message in context: http://cxf.547215.n5.nabble.com/NPE-when-unmarshaling-Service-Specific-Fault-tp5739162.html
Sent from the cxf-user mailing list archive at Nabble.com.