Let's assume java.lang.Object maps to xsd:anyType. Maybe we can check the object to see if it is a subclass of the parameter type. If the subclass is not part of the JAXBContext, then we create a new JAXBContext to include it. It might help the transformation from JAXB to XML (I expect to see a xsi:type for the subtype such as xsi:type="foo:FooType"). But we cannot handle the XML to JAXB path because we don't know the subclass for the JAXB object. IIRC, the XML will be unmarshalled into the base type and the properties in the subtype lost.

Thanks,
Raymond

From: Scott Kurz
Sent: Wednesday, September 10, 2008 6:53 AM
To: [email protected]
Subject: Re: JAXBException


Dave,

The issue is that we look at the interface to determine what types to register with the JAXBContext. Your interface only shows java.lang.Object as the input type... and though com.example.jms.JMSPOJO extends Object, the JAXBContext was not set up to know about this type.

I was wondering myself what to do about this issue... and also what, say, the Axis2 runtime does in this situation.

Scott



On Wed, Sep 10, 2008 at 9:28 AM, Dave Sowerby <[EMAIL PROTECTED]> wrote:

Hey guys,

I'm encountering a problem in the serialization of Objects when using
binding.jms and a method signature of:

public String sayHello(Object obj);

Basically, I pass a POJO and on the client side during transformation
for transport, I get the below stack...

It looks like the class in question hasn't been registered with the
JAXBContext - can anyone give me any pointers here, I'm concerned I'm
doing something obviously silly!

Cheers,

Dave.

org.apache.tuscany.sca.databinding.TransformationException:
javax.xml.bind.MarshalException - with linked exception:
[javax.xml.bind.JAXBException: class com.example.jms.JMSPOJO nor any
of its super class is known to this context.]
at org.apache.tuscany.sca.databinding.jaxb.JAXB2Node.transform(JAXB2Node.java:52) at org.apache.tuscany.sca.databinding.jaxb.JAXB2Node.transform(JAXB2Node.java:36) at org.apache.tuscany.sca.databinding.DefaultTransformerExtensionPoint$LazyPullTransformer.transform(DefaultTransformerExtensionPoint.java:199) at org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl..java:81) at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformertransform(Input2InputTransformer.java:247) at org.apache.tuscany.sca.core.databinding.transformers.Input2InputTransformertransform(Input2InputTransformer.java:45) at org.apache.tuscany.sca.databinding.impl.MediatorImpl.mediate(MediatorImpl..java:81) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.transform(DataTransformationInterceptor.java:186) at org.apache.tuscany.sca.core.databinding.wire.DataTransformationInterceptor.invoke(DataTransformationInterceptor.java:76) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:287) at org.apache.tuscany.sca.core.invocation.JDKInvocationHandler.invoke(JDKInvocationHandler.java:154)
at $Proxy9.sayHello(Unknown Source)

--
Dave Sowerby MEng MBCS

Reply via email to