You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by jfauble <jf...@gmail.com> on 2011/03/08 14:56:04 UTC

[DOSGi] XmlTransient Annotation Ignored

Hello CXF Community,


I'm using the CXF DOSGi 1.2 multi-bundle distribution using Spring-DM and
configured to use JAXB (see osgi-context.xml below).  My model has a parent
object with a list of children which have a reference to the parent.  I was
aware that the circular reference would cause an issue with JAXB so I
applied the XmlTransient annotation as I have done in past projects, but
still received the following error.


I have tried the various fixes/workarounds described in these posts with
numerous permutations of XmlRootElement, XMLType, XMLTransient (on fields,
getters, setters), but the XMLTransient annotation appears to have no
impact.

http://cxf.547215.n5.nabble.com/CXF-doesn-t-respect-annotations-td563003.html
http://cxf.547215.n5.nabble.com/CXF-doesn-t-respect-annotations-td563003.html 

https://issues.apache.org/jira/browse/CXF-1121
https://issues.apache.org/jira/browse/CXF-1121 



Any help would be greatly appreciated.

Thanks,

Jason



### Exception Stack Trace
WARNING: Interceptor for
{http://service.domain.envoy.syntech.org/}IOrganizationServiceService#{http://service.domain.envoy.syntech.org/}getOrganization
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Marshalling Error: A cycle is detected in
the object graph. This will cause infinitely deep XML: Organization
[internalKey=1, id=001, description=Acme Oil, Inc.] ->
org.syntech.envoy.domain.model.Facility@111c3f0 -> Organization
[internalKey=1, id=001, description=Acme Oil, Inc.]
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:247)
	at org.apache.cxf.jaxb.io.DataWriterImpl.write(DataWriterImpl.java:169)
	at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:111)
	at
org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
	at
org.apache.cxf.interceptor.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:78)
	at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:243)
	at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:110)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:312)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:276)
	at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
	at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:206)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:324)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
	at
org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
	at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
	at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: javax.xml.bind.MarshalException
 - with linked exception:
[com.sun.istack.SAXException2: A cycle is detected in the object graph. This
will cause infinitely deep XML: Organization [internalKey=1, id=001,
description=Acme Oil, Inc.] ->
org.syntech.envoy.domain.model.Facility@111c3f0 -> Organization
[internalKey=1, id=001, description=Acme Oil, Inc.]]
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:331)
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:257)
	at
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:100)
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:532)
	at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:222)
	... 21 more
Caused by: com.sun.istack.SAXException2: A cycle is detected in the object
graph. This will cause infinitely deep XML: Organization [internalKey=1,
id=001, description=Acme Oil, Inc.] ->
org.syntech.envoy.domain.model.Facility@111c3f0 -> Organization
[internalKey=1, id=001, description=Acme Oil, Inc.]
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:244)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.pushObject(XMLSerializer.java:533)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:627)
	at
com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
	at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
	at
com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
	at
com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
	at
com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:152)
	at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
	at
com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:150)
	at
com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:322)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:681)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:151)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:185)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:305)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:312)
	at
com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:71)
	at
com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:490)
	at
com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:328)
	... 25 more
### end Exception

### osgi-context.xml
...
	
		
			
			
			 
			 
			
		
	
...
### end osgi-context.xml

### list of bundles included in osgi container
id	State       Bundle
0	ACTIVE      org.eclipse.osgi_3.6.2.R36x_v20110210
	            Fragments=7
1	ACTIVE      org.springframework.core_2.5.6
2	RESOLVED    org.eclipse.persistence.jpa.equinox_2.1.2.v20101206-r8635
	            Master=13
4	ACTIVE      org.syntech.core.persistence.derby_1.0.0.qualifier
5	ACTIVE      org.syntech.core.domain_1.0.0.qualifier
6	ACTIVE      org.springframework.aop_2.5.6
7	RESOLVED   
org.eclipse.persistence.jpa.equinox.weaving_2.1.2.v20101206-r8635
	            Master=0
8	ACTIVE      org.eclipse.persistence.asm_2.1.2.v20101206-r8635
9	ACTIVE      javax.persistence_2.0.1.v201006031150
10	ACTIVE      com.springsource.org.apache.commons.beanutils_1.8.0
11	ACTIVE      com.springsource.org.apache.commons.collections_3.2.1
12	ACTIVE      org.springframework.beans_2.5.6
13	ACTIVE      org.eclipse.persistence.jpa_2.1.2.v20101206-r8635
	            Fragments=2, 23
14	ACTIVE      org.springframework.context_2.5.6
15	ACTIVE      org.springframework.osgi.io_1.2.0
16	ACTIVE      org.syntech.core.domain.jpa_1.0.0.qualifier
17	ACTIVE      org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
	            Fragments=19
18	ACTIVE      org.springframework.osgi.extender_1.2.0
19	RESOLVED    org.syntech.core.config.log4j_1.0.0.qualifier
	            Master=17
20	ACTIVE      org.springframework.osgi.core_1.2.0
21	ACTIVE      com.springsource.org.aopalliance_1.0.0
22	ACTIVE      org.eclipse.persistence.core_2.1.2.v20101206-r8635
	            Fragments=26
23	RESOLVED    org.eclipse.persistence.jpa.osgi_2.1.2.v20101206-r8635
	            Master=13
25	ACTIVE      org.eclipse.osgi.services_3.2.100.v20100503
26	RESOLVED    org.eclipse.persistence.oracle_2.1.2.v20101206-r8635
	            Master=22
27	ACTIVE      com.springsource.org.apache.commons.logging_1.1.1
28	ACTIVE      org.eclipse.persistence.antlr_2.1.2.v20101206-r8635
29	ACTIVE      org.apache.servicemix.specs.jaxws-api-2.1_1.3.0
30	ACTIVE      cxf-dosgi-ri-topology-manager_1.2.0
31	ACTIVE      org.apache.servicemix.specs.saaj-api-1.3_1.3.0
32	ACTIVE      com.springsource.slf4j.api_1.5.10
	            Fragments=46
33	ACTIVE      org.apache.servicemix.bundles.xmlresolver_1.2.0.1
34	ACTIVE      org.apache.servicemix.bundles.xmlsec_1.3.0.1
35	ACTIVE      cxf-dosgi-ri-discovery-local_1.2.0
36	ACTIVE      org.apache.servicemix.bundles.jaxb-impl_2.1.6.1
37	ACTIVE      org.apache.servicemix.bundles.asm_2.2.3.1
38	ACTIVE      org.apache.servicemix.bundles.commons-pool_1.5.4.1
39	ACTIVE      org.apache.servicemix.bundles.woodstox_3.2.7.1
40	ACTIVE      org.apache.cxf.bundle-minimal_2.2.9
41	ACTIVE      org.apache.servicemix.bundles.xmlschema_1.4.3.1
42	ACTIVE      com.springsource.org.jdom_1.0.0
43	ACTIVE      org.apache.geronimo.specs.geronimo-activation_1.1_spec_1.0.2
44	ACTIVE      org.ops4j.pax.web.service_0.5.1
45	ACTIVE      org.apache.servicemix.specs.jaxb-api-2.1_1.3.0
46	RESOLVED    com.springsource.slf4j.jcl_1.5.10
	            Master=32
47	ACTIVE      org.apache.geronimo.specs.geronimo-annotation_1.0_spec_1.1.1
48	ACTIVE      org.apache.servicemix.specs.stax-api-1.0_1.3.0
49	ACTIVE      org.apache.geronimo.specs.geronimo-ws-metadata_2.0_spec_1.1.2
50	ACTIVE      org.apache.geronimo.specs.geronimo-javamail_1.4_spec_1.2.0
51	ACTIVE      org.apache.servicemix.bundles.neethi_2.0.4.1
52	ACTIVE      org.apache.servicemix.bundles.wsdl4j_1.6.1.1
53	ACTIVE      org.apache.servicemix.specs.jsr311-api-1.0_1.3.0
54	ACTIVE      cxf-dosgi-ri-dsw-cxf_1.2.0
57	ACTIVE      org.syntech.envoy.domain_1.0.0.qualifier
58	ACTIVE      org.syntech.envoy.domain.jpa_1.0.0.qualifier
### end list of bundles



--
View this message in context: http://cxf.547215.n5.nabble.com/DOSGi-XmlTransient-Annotation-Ignored-tp3413949p3413949.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: [DOSGi] XmlTransient Annotation Ignored

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

On Mon, Mar 14, 2011 at 2:43 PM, Jason Fauble <jf...@gmail.com> wrote:

> Any help out there.  It appears as though the DOSGi doesn't have much
> momentum lately.  Should I be going in a different direction?
>
> Just one comment about the DOSGI momentum. David can hopefully provide more
detailed info, but AFAIK DOSGi RI is the most complete implementation of the
relevant spec. The OSGI world is big and of course there are many options
there. DOSGI RI has not seen a lot of activity recently, as far as merging
various fixes is concerned, but I think it is fair to say it is being used.
At this stage of its life, the community contributions are important. Most
of the issues I've seen being reported recently can be tracked and fixed by
not only CXF committers. Of course, it would be nice to see a reported issue
resolved in a few days or so but at the moment DOSGI RI needs a bit of help
:-)

Thanks, Sergey

Re: [DOSGi] XmlTransient Annotation Ignored

Posted by Jason Fauble <jf...@gmail.com>.
Thanks for the reply Daniel,

I changed the start order of the two jaxb bundles that you pointed out and
modified the Manifest to the following which fixed the issue.


Thank you for your help.  I don't know that I would have ever tracked that
down on my own.  I'm new to OSGi and up to now I've considered it a success
when all of the dependencies are meet.  I guess I need to be more mindful
about *how* the dependencies are meet.  I'll experiment a little to see if I
can get a grasp on the art/science of it.

Thanks again,
Jason


### MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Envoy Domain
Bundle-SymbolicName: org.syntech.envoy.domain
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: Syn-Tech Systems, Inc.
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.syntech.envoy.domain.dao,
 org.syntech.envoy.domain.model,
 org.syntech.envoy.domain.service
Import-Package: javax.jws,
 javax.xml.bind;version="2.1.0",
 javax.xml.bind.annotation;version="2.1.0",
 javax.xml.ws;version="2.1.0",
 org.syntech.core.domain.dao,
 org.syntech.core.domain.model

### end manifest



--
View this message in context: http://cxf.547215.n5.nabble.com/DOSGi-XmlTransient-Annotation-Ignored-tp3413949p3611691.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: [DOSGi] XmlTransient Annotation Ignored

Posted by Daniel Kulp <dk...@apache.org>.
On Monday 14 March 2011 10:43:57 AM Jason Fauble wrote:
> Any help out there.  It appears as though the DOSGi doesn't have much
> momentum lately.  Should I be going in a different direction?

What does the manifest on your application bundle look like?     Are you 
importing the javax.xml.bind package with the proper 2.1 version?

Also, it looks like you have a startup ordering issue:


36	ACTIVE      org.apache.servicemix.bundles.jaxb-impl_2.1.6.1
45	ACTIVE      org.apache.servicemix.specs.jaxb-api-2.1_1.3.0

That looks like a potential problem, at least on Java6.     The jaxb impl may 
be getting the javax.xml.bind stuff from the JDK  instead and your bundle may 
be picking up the smx version.



> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/DOSGi-XmlTransient-Annotation-Ignored-tp34
> 13949p3556432.html Sent from the cxf-user mailing list archive at
> Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: [DOSGi] XmlTransient Annotation Ignored

Posted by Jason Fauble <jf...@gmail.com>.
Any help out there.  It appears as though the DOSGi doesn't have much
momentum lately.  Should I be going in a different direction?

--
View this message in context: http://cxf.547215.n5.nabble.com/DOSGi-XmlTransient-Annotation-Ignored-tp3413949p3556432.html
Sent from the cxf-user mailing list archive at Nabble.com.