You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Blue Diamond <gv...@gmail.com> on 2010/10/13 13:34:53 UTC

[TUSCANY-2.0] Object injection into a service

Hi all,

we developed our services on tuscany 1.6 and are able to inject our objects
containing business logic into SCA service objects. but this is not working
in 2.0 for when I am invoking my "addReference(object)" on my service, it is
using JAXB binding (probably invoking on WS instead of SCA binding?).

service composite has <binding.sca/> defined.

code looks something like this:

Node node = NodeFactory.newInstance().createNode(new
StringReader(compositeXml), contrib1, contrib2);
ServiceInterface obj = (ServiceInterface) node.getService(serviceInterface,
serviceName);
obj.addReference(businessObject);

and the last line throws this exception:

javax.xml.bind.JAXBException: class
my.domain.sca.server.PersistentDomainManager nor any of its super class is
known to this context.]
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:110)
at
org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding.copy(JAXBDataBinding.java:118)
... 25 more
Caused by: javax.xml.bind.JAXBException: class
my.domain.sca.server.PersistentDomainManager nor any of its super class is
known to this context.
at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:315)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:322)
at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
... 28 more
Caused by: javax.xml.bind.JAXBException: class
my.domain.sca.server.PersistentDomainManager nor any of its super class is
known to this context.
at
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
... 35 more


can somebody help. i m hoping that this support is present in 2.0. but why
is it failing? is there anything explicitly that needs to be defined to get
this working? can someone throws some light on API is i m using it
incorrectly?

thanks & regards,
Anil

Re: [TUSCANY-2.0] Object injection into a service

Posted by Blue Diamond <gv...@gmail.com>.
Hi Raymond,

Thanks for your response. But we don't have any JAXB annotated classes
anywhere in our code!

Also, in this case JAXB has no role to play and shouldn't even show up given
that fact that we are adding an object reference which should involved
binding.sca (as does tuscany1.6)

Regards,
Anil

On Wed, Oct 13, 2010 at 8:28 PM, Raymond Feng <en...@gmail.com> wrote:

> If the JAXB class is not directly or indirectly referenced from the
> interface, you'll need to use @XmlSeeAlso at the JAXB class or interface.
>
> Raymond Feng
> Sent from my iPhone
>
> On Oct 13, 2010, at 4:34 AM, Blue Diamond <gv...@gmail.com> wrote:
>
> > Hi all,
> >
> > we developed our services on tuscany 1.6 and are able to inject our
> objects containing business logic into SCA service objects. but this is not
> working in 2.0 for when I am invoking my "addReference(object)" on my
> service, it is using JAXB binding (probably invoking on WS instead of SCA
> binding?).
> >
> > service composite has <binding.sca/> defined.
> >
> > code looks something like this:
> >
> > Node node = NodeFactory.newInstance().createNode(new
> StringReader(compositeXml), contrib1, contrib2);
> > ServiceInterface obj = (ServiceInterface)
> node.getService(serviceInterface, serviceName);
> > obj.addReference(businessObject);
> >
> > and the last line throws this exception:
> >
> > javax.xml.bind.JAXBException: class
> my.domain.sca.server.PersistentDomainManager nor any of its super class is
> known to this context.]
> >       at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> >       at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> >       at
> javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:110)
> >       at
> org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding.copy(JAXBDataBinding.java:118)
> >       ... 25 more
> > Caused by: javax.xml.bind.JAXBException: class
> my.domain.sca.server.PersistentDomainManager nor any of its super class is
> known to this context.
> >       at
> com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> >       at
> com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> >       at
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> >       at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
> >       at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
> >       at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:315)
> >       at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:322)
> >       at
> com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
> >       at
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> >       at
> com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> >       ... 28 more
> > Caused by: javax.xml.bind.JAXBException: class
> my.domain.sca.server.PersistentDomainManager nor any of its super class is
> known to this context.
> >       at
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
> >       at
> com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> >       ... 35 more
> >
> >
> > can somebody help. i m hoping that this support is present in 2.0. but
> why is it failing? is there anything explicitly that needs to be defined to
> get this working? can someone throws some light on API is i m using it
> incorrectly?
> >
> > thanks & regards,
> > Anil
> >
> >
> >
>

Re: [TUSCANY-2.0] Object injection into a service

Posted by Raymond Feng <en...@gmail.com>.
If the JAXB class is not directly or indirectly referenced from the interface, you'll need to use @XmlSeeAlso at the JAXB class or interface.

Raymond Feng
Sent from my iPhone

On Oct 13, 2010, at 4:34 AM, Blue Diamond <gv...@gmail.com> wrote:

> Hi all,
> 
> we developed our services on tuscany 1.6 and are able to inject our objects containing business logic into SCA service objects. but this is not working in 2.0 for when I am invoking my "addReference(object)" on my service, it is using JAXB binding (probably invoking on WS instead of SCA binding?).
> 
> service composite has <binding.sca/> defined.
> 
> code looks something like this:
> 
> Node node = NodeFactory.newInstance().createNode(new StringReader(compositeXml), contrib1, contrib2);
> ServiceInterface obj = (ServiceInterface) node.getService(serviceInterface, serviceName);
> obj.addReference(businessObject);
> 
> and the last line throws this exception:
> 
> javax.xml.bind.JAXBException: class my.domain.sca.server.PersistentDomainManager nor any of its super class is known to this context.]
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:318)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
> 	at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:110)
> 	at org.apache.tuscany.sca.databinding.jaxb.JAXBDataBinding.copy(JAXBDataBinding.java:118)
> 	... 25 more
> Caused by: javax.xml.bind.JAXBException: class my.domain.sca.server.PersistentDomainManager nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:246)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:261)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:653)
> 	at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
> 	at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
> 	at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:315)
> 	at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:322)
> 	at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
> 	at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
> 	... 28 more
> Caused by: javax.xml.bind.JAXBException: class my.domain.sca.server.PersistentDomainManager nor any of its super class is known to this context.
> 	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:590)
> 	at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:648)
> 	... 35 more
> 
> 
> can somebody help. i m hoping that this support is present in 2.0. but why is it failing? is there anything explicitly that needs to be defined to get this working? can someone throws some light on API is i m using it incorrectly?
> 
> thanks & regards,
> Anil
> 
> 
>