Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-3268

Calling AuctionService webservice gives marshalling error

    Details

    • Estimated Difficulty:
      Low

      Description

      After deploying the seambay example in Jboss, I encountered the following error while invoking the webservice AuctionService from soapUI:

      [com.sun.istack.SAXException2: A cycle is detected in the object graph. This will cause infinitely deep XML: org.jboss.seam.example.seambay.Auction@1df2b92 -> org.jboss.seam.example.seambay.AuctionImage@1d90a6e -> org.jboss.seam.example.seambay.Auction@1df2b92]
      at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:295)
      at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:221)
      at org.jboss.ws.core.jaxws.JAXBSerializer.serialize(JAXBSerializer.java:83)

      After looking at the annotations in Auction and AuctionImage it just is very clear: the association between the two classes is bidirectional; and thus causing the Marshaller to throw this error. (Because it cannot find out when to stop following references).

      After googling/thinking I added an @XmlTransient annotation to AuctionImage#getAuction (see patch) , and thus breaking the loop when marshalling.
      Now the webserive produces some result and is not giving errors anymore!

      The problem-yet-to-solve (curious how you guys would solve): With this XmlTransient, xml2object unmarshalling is not fully supported anymore (I broke the loop...).

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                shane.bryzak Shane Bryzak
                Reporter:
                janhoeve Jan Hoeve (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: