Categories

Main
Database
Java
Microsoft.NET
Adabas
DB2
Informix
Microsoft SQL Server
MySQL
Oracle
Pervasive.SQL
PostgreSQL
Sybase
Other
ASP
ColdFusion
Crystal Reports
Delphi, C etc
JAVA
Microsoft.NET
Perl and the DBI
PHP
ANSI SQL
Unix Shell Scripts
Visual Basic
XML & XSLT
Corel Paradox
FileMaker
Microsoft Access
Microsoft Excel
Other PC Databases
Applications & Tools
Database Concepts & Design
EJB programming & troubleshooting
EJB design
General J2EE
XML & Web services
Web tier: servlets, JSP, Web frameworks
Performance and scalability
Industry news
TSS feedback
Mobicents Contributors
Mobicents Users
JSLEE Resource Adaptor Types
Planning JavaOne 2008
Sun Tech Days
Other Java conferences
Binary Web Services and XML
Metro and JAXB
GlassFish
GlassFish Plugins
Project jMaki
GlassFish WebTier
Mural
Java Development Tools
Java WS & XML Community News
JAXP
Java SE
6uN Early Access
Java Quick Starter
Java SE Snapshots: Project Feedback
JCK Forum
Feedback and Suggestions
JDK Distros
JDK Open Source
General JSR Discussion
JCP 2.6
JXTA Community Forum
ME Interest
ME Cool Apps
ME General Help
ME Feedback & Suggestions
ME Application Developer Interest
Blu-ray Disc Java
ME Developer Days
Squawk
Mobile Developer Alliance
OpenCable
LWUIT
JavaFX Script Language Discussion
OpenJFX General Discussion
Scene Graph
General Performance Discussion
Your Java Career
NetBeans 6.0
Servlets
JSP
JSF
Portals and Portlets
EJB and Other Java EE Technologies
Distributed Java
Object Relational Mapping
JDBC
Web Services
Swing / AWT / SWT / JFace
JNLP and Web Start
Java Micro Edition
Sockets and Internet Protocols
Threads and Synchronization
Performance
Applets
I/O and Streams
Other Java APIs
Game Development
Java in General (beginner)
Java in General (intermediate)
Java in General (advanced)
Programmer Certification (SCJP)
Developer Certification (SCJD)
Associate Certification (SCJA)
Web Component Certification (SCWCD)
EJB Certification (SCBCD)
Mobile Application Certification (SCMAD)
Architect Certification (SCEA)
Web Services Certification (SCDJWS)
XML Certification
Product and Other Certifications
Mock Exam Errata
Sun Certification Results
Authors' Corral
Book Reviews
Events
Bunkhouse Porch
Teachers' Lounge
Testing
OO, Patterns, UML and Refactoring
IDEs, Version Control and other tools
Ant, Maven and Other Build Tools
Linux / UNIX
Mac OS
HTML and JavaScript
XML and Related Technologies
Agile and Other Processes
General Computing
Security
Groovy
Scala
Other Languages
Struts
Application Frameworks
Other Open Source Projects
BEA/Weblogic
IBM/Websphere
Oracle/OAS
Apache/Tomcat
JBoss
Other Java Products and Servers
JavaRanch
Cattle Drive (java college)
Moderators Only
Trash Can
Jobs Offered
Jobs Wanted
Jobs Discussion
Meaningless Drivel
Programming Diversions
Blatant Advertising
Java Announcements
New To Java
Advanced Java
Java Applets
Networking
Threads and Synchronization
Java 2D
AWT / Swing
SWT / JFace
CLDC and MIDP
CDC and Personal Profile
Sun Java Wireless Toolkit
Enterprise JavaBeans
JavaServer Pages (JSP) and JSTL
Java Servlet
JavaServer Faces
Web Frameworks
Database
XML
Lucene
NetBeans
Eclipse
IntelliJ IDEA
JCreator
Other IDEs
Java Tutorials
Java Tips
Jobs Discussion
Jobs Offered
Jobs Wanted
Professional Certification
Forum Lobby
Java Blogs
Introductions
Reviews / Advertising
Suggestions & Feedback

Resources

Java Database
Linux
Coding
Mobile
Hardware
Software Development
Software Development
iOS,OS X
iOS,OS X
ORACLE
IBM DEVELOPER
IBM DEVELOPER
MSDN
MSDN


Tags

GlassFish

This forum has been created for discussing the GlassFish project, the Community Development of the latest version of the J2EE SDK.

A cycle in the object graph: This will cause infinitely deep XML


Hi, I've used NetBeans to generate entities from database.  However, when I try to use them I get this exception:Caused by: com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: 1 -> 1 -> 1        at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:225)        at com.sun.xml.bind.v2.runtime.XMLSerializer.pushObject(XMLSerializer.java:483)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:574)        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:114)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:29)        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:132)        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:101)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:29)        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:132)        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:101)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:241)        ... 35 moreI think this has something to do with the relationships not being mapped correctly by NetBeans -- but if someone knows what the cause of this is, or can explain to me how to fix it, I'd appreciate it greatly.

When do you get this exception? Supply the complete stack trace? Can you also supply the entity code that gets generated?-- Sahoo

Sure, here is an example of an entity:http://pastebin.ca/160400(link will expire in one week)I get this exception when testing my beans with the webservice tester (I just add @WebService to the facade).Stack trace:[#|2006-09-01T16:55:57.796+0200|WARNING|sun-appserver-ee9.1|javax.enterprise.system.container.ejb|_ThreadID=12;_ThreadName=httpWorkerThread-8080-0;_RequestID=eac2ef83-2bc9-4928-9f18-9bac6f4bffd7;|invocation error on ejb endpoint DepartmentSessionBean at /DepartmentService/DepartmentSessionBean : 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: 1 -> 1 -> 1]javax.xml.ws.WebServiceException: 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: 1 -> 1 -> 1]        at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:248)        at com.sun.xml.ws.message.AbstractMessageImpl.writeTo(AbstractMessageImpl.java:124)        at com.sun.xml.ws.encoding.StreamSOAPCodec.encode(StreamSOAPCodec.java:91)        at com.sun.xml.ws.encoding.CodecFacade.encode(CodecFacade.java:170)        at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:182)        at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:223)        at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:97)        at com.sun.enterprise.webservice.NewEjb3MessageDispatcher.handlePost(NewEjb3MessageDispatcher.java:98)        at com.sun.enterprise.webservice.NewEjb3MessageDispatcher.invoke(NewEjb3MessageDispatcher.java:72)        at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:182)        at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:111)        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)        at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:101)        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:71)        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)        at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)        at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:586)        at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:556)        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)        at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:619)        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.processNonBlocked(DefaultProcessorTask.java:550)        at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:780)        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:251)        at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:205)        at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)        at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:103)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: 1 -> 1 -> 1]        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:246)        at com.sun.xml.bind.v2.runtime.BridgeImpl.marshal(BridgeImpl.java:64)        at com.sun.xml.bind.api.Bridge.marshal(Bridge.java:96)        at com.sun.xml.ws.message.jaxb.JAXBMessage.writePayloadTo(JAXBMessage.java:239)        ... 32 moreCaused by: com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: 1 -> 1 -> 1        at com.sun.xml.bind.v2.runtime.XMLSerializer.reportError(XMLSerializer.java:225)        at com.sun.xml.bind.v2.runtime.XMLSerializer.pushObject(XMLSerializer.java:483)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:574)        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:114)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:29)        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:132)        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:101)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:29)        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:132)        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:101)        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:286)        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:619)        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:241)        ... 35 more|#]

It happens when I run the findAll() method by the way.- bjorn

See https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.htmlAlso check JAXB & JAX-WS forum archive for threads related to this.

Yepp, I've read that link - it's the only thing that turns up on Google when searching for the exception (for now).I don't think it's the solution to add transient annotations to the fields that causes this. We need to persist them, and we need to keep the relationship.


Related Links

GlassFish v2 UR plans
web project with seam and glassfish
Reflection problem with glass fish V2 (calling all reflection experts)
Security password question
WS and MDB unit testing
Expected a child component type of UISelectItem/UISelectItems
GlassFish 9.1 bug
Migration from JBoss to Glassfish
pebble glassfish errors...
what file would I have to abuse to get...
[Fwd: Hyperjaxb3 release 0.2]
JPA Inheritance mapping and relations
Admin Console problem
run a GlassFish test on windows
install GlassFish on Solaris
Glassfish v2 / Netbeans 6Beta1 & log4j