在对象图中检测到循环。这将导致无限循环

时间:2014-08-22 17:32:46

标签: jaxb jersey eclipselink moxy

人,

寻找一点指导。我正在使用Jersey 2.11并从XSD生成JAXB定义。

我有一个似乎是基于时间的定期异常。如果我改变了发送的消息的时间,则不会发生错误。另一个问题是错误中报告的周期有时会发生变化,但是,根据XSD定义,报告的周期不会发生。我也在发送之前转储了消息,它肯定不包含报告的周期。

在这个特定场景中,我发送的NotificationType消息包含DocumentType列表,但是,DocumentType永远不能包含NotificationType,因此以下周期是不可能的:

net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc - > net.es.nsi.pce.discovery.jaxb.NotificationType@454b147c - > net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc

我想知道是否有不同的理由接收以下异常?

感谢您的帮助。

  

[错误] [08/22/2014 13:11:45.126]   [NSI-DISCOVERY-akka.actor.default-调度-5]   [akka:// NSI-DISCOVERY / user / discovery-notificationRouter / $ b] HTTP 500   内部服务器错误javax.ws.rs.ProcessingException:HTTP 500   内部服务器错误   org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:255)     在   org.glassfish.jersey.client.JerseyInvocation $ 1.call(JerseyInvocation.java:667)     在   org.glassfish.jersey.client.JerseyInvocation $ 1.call(JerseyInvocation.java:664)     在org.glassfish.jersey.internal.Errors.process(Errors.java:315)at   org.glassfish.jersey.internal.Errors.process(Errors.java:297)at   org.glassfish.jersey.internal.Errors.process(Errors.java:228)at   org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)     在   org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:664)     在   org.glassfish.jersey.client.JerseyInvocation $ Builder.method(JerseyInvocation.java:424)     在   org.glassfish.jersey.client.JerseyInvocation $ Builder.post(JerseyInvocation.java:333)     在   net.es.nsi.pce.discovery.actors.NotificationActor.onReceive(NotificationActor.java:100)     在   akka.actor.UntypedActor $$ anonfun $获得$ 1.applyOrElse(UntypedActor.scala:167)     at akka.actor.Actor $ class.aroundReceive(Actor.scala:465)at   akka.actor.UntypedActor.aroundReceive(UntypedActor.scala:97)at at   akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)at at   akka.actor.ActorCell.invoke(ActorCell.scala:487)at   akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)at   akka.dispatch.Mailbox.run(Mailbox.scala:220)at   akka.dispatch.ForkJoinExecutorConfigurator $ AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)     在   scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)     在   scala.concurrent.forkjoin.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1339)     在   scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)     在   scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)   引起:javax.ws.rs.InternalServerErrorException:HTTP 500内部   服务器错误   org.glassfish.jersey.message.internal.AbstractJaxbElementProvider.writeTo(AbstractJaxbElementProvider.java:152)     在   org.glassfish.jersey.message.internal.AbstractJaxbElementProvider.writeTo(AbstractJaxbElementProvider.java:85)     在   org.glassfish.jersey.message.internal.WriterInterceptorExecutor $ TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)     在   org.glassfish.jersey.message.internal.WriterInterceptorExecutor $ TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)     在   org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)     在   org.glassfish.jersey.filter.LoggingFilter.aroundWriteTo(LoggingFilter.java:293)     在   org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)     在   org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1154)     在   org.glassfish.jersey.client.ClientRequest.writeEntity(ClientRequest.java:503)     在   org.glassfish.jersey.client.HttpUrlConnector._apply(HttpUrlConnector.java:315)     在   org.glassfish.jersey.client.HttpUrlConnector.apply(HttpUrlConnector.java:227)     在   org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:246)     ... 22更多引起:javax.xml.bind.MarshalException     - 链接异常:[Exception [EclipseLink-25003](Eclipse Persistence Services - 2.5.0.v20130507-3faac2b):   org.eclipse.persistence.exceptions.XMLMarshalException异常   说明:编组对象内部时发生错误   例外:异常[EclipseLink-25037](Eclipse Persistence Services    - 2.5.0.v20130507-3faac2b):org.eclipse.persistence.exceptions.XMLMarshalException异常   描述:在对象图中检测到循环。这将导致   无限循环:net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc    - > net.es.nsi.pce.discovery.jaxb.NotificationType@454b147c - > net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc] at   org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:403)     在   org.glassfish.jersey.message.internal.XmlJaxbElementProvider.writeTo(XmlJaxbElementProvider.java:139)     在   org.glassfish.jersey.message.internal.AbstractJaxbElementProvider.writeTo(AbstractJaxbElementProvider.java:150)     ... 33更多引起:异常[EclipseLink-25003](Eclipse   持久性服务 - 2.5.0.v20130507-3faac2b):   org.eclipse.persistence.exceptions.XMLMarshalException异常   说明:编组对象内部时发生错误   例外:异常[EclipseLink-25037](Eclipse Persistence Services    - 2.5.0.v20130507-3faac2b):org.eclipse.persistence.exceptions.XMLMarshalException异常   描述:在对象图中检测到循环。这将导致   无限循环:net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc    - > net.es.nsi.pce.discovery.jaxb.NotificationType@454b147c - > net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc at   org.eclipse.persistence.exceptions.XMLMarshalException.marshalException(XMLMarshalException.java:97)     在   org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:911)     在   org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:848)     在   org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:401)     ... 35更多引起:异常[EclipseLink-25037](Eclipse   持久性服务 - 2.5.0.v20130507-3faac2b):   org.eclipse.persistence.exceptions.XMLMarshalException异常   描述:在对象图中检测到循环。这将导致   无限循环:net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc    - > net.es.nsi.pce.discovery.jaxb.NotificationType@454b147c - > net.es.nsi.pce.discovery.jaxb.DocumentType@5a0eb1fc at   org.eclipse.persistence.exceptions.XMLMarshalException.objectCycleDetected(XMLMarshalException.java:400)     在   org.eclipse.persistence.internal.oxm.XPathObjectBuilder.buildRow(XPathObjectBuilder.java:207)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:118)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:1)     在   org.eclipse.persistence.internal.oxm.XMLCompositeObjectMappingNodeValue.marshalSingleValue(XMLCompositeObjectMappingNodeValue.java:237)     在   org.eclipse.persistence.internal.oxm.XMLCompositeObjectMappingNodeValue.marshal(XMLCompositeObjectMappingNodeValue.java:149)     在   org.eclipse.persistence.internal.oxm.NodeValue.marshal(NodeValue.java:102)     在   org.eclipse.persistence.internal.oxm.record.ObjectMarshalContext.marshal(ObjectMarshalContext.java:59)     在   org.eclipse.persistence.internal.oxm.XPathNode.marshal(XPathNode.java:393)     在   org.eclipse.persistence.internal.oxm.XPathObjectBuilder.buildRow(XPathObjectBuilder.java:238)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:118)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:1)     在   org.eclipse.persistence.internal.oxm.XMLCompositeCollectionMappingNodeValue.marshalSingleValue(XMLCompositeCollectionMappingNodeValue.java:321)     在   org.eclipse.persistence.internal.oxm.XMLCompositeCollectionMappingNodeValue.marshal(XMLCompositeCollectionMappingNodeValue.java:104)     在   org.eclipse.persistence.internal.oxm.NodeValue.marshal(NodeValue.java:149)     在   org.eclipse.persistence.internal.oxm.NodeValue.marshal(NodeValue.java:102)     在   org.eclipse.persistence.internal.oxm.record.ObjectMarshalContext.marshal(ObjectMarshalContext.java:59)     在   org.eclipse.persistence.internal.oxm.XPathNode.marshal(XPathNode.java:393)     在   org.eclipse.persistence.internal.oxm.XPathObjectBuilder.buildRow(XPathObjectBuilder.java:238)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:118)     在   org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:1)     在   org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:743)     在   org.eclipse.persistence.internal.oxm.XMLMarshaller.marshal(XMLMarshaller.java:901)     ......还有37个

Notification.java

package net.es.nsi.pce.discovery.jaxb;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NotificationType", namespace = "http://schemas.ogf.org/nsi/2014/02/discovery/types", propOrder = {
    "discovered",
    "event",
    "document",
    "any"
})
public class NotificationType {

    @XmlElement(required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar discovered;
    @XmlElement(required = true)
    protected DocumentEventType event;
    @XmlElement(required = true)
    protected DocumentType document;
    @XmlAnyElement(lax = true)
    protected List<Object> any;
    @XmlAnyAttribute
    private Map<QName, String> otherAttributes = new HashMap<QName, String>();

    public XMLGregorianCalendar getDiscovered() {
        return discovered;
    }

    public void setDiscovered(XMLGregorianCalendar value) {
        this.discovered = value;
    }

    public DocumentEventType getEvent() {
        return event;
    }

    public void setEvent(DocumentEventType value) {
        this.event = value;
    }

    public DocumentType getDocument() {
        return document;
    }

    public void setDocument(DocumentType value) {
        this.document = value;
    }

    public List<Object> getAny() {
        if (any == null) {
            any = new ArrayList<Object>();
        }
        return this.any;
    }

    public Map<QName, String> getOtherAttributes() {
        return otherAttributes;
    }

}

DocumentType.java

package net.es.nsi.pce.discovery.jaxb;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.namespace.QName;
import org.w3c.dom.Element;

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DocumentType", namespace = "http://schemas.ogf.org/nsi/2014/02/discovery/types", propOrder = {
    "nsa",
    "type",
    "signature",
    "content",
    "any"
})
public class DocumentType {

    @XmlElement(required = true)
    @XmlSchemaType(name = "anyURI")
    protected String nsa;
    @XmlElement(required = true)
    protected String type;
    protected AnyType signature;
    protected AnyType content;
    @XmlAnyElement(lax = true)
    protected List<Object> any;
    @XmlAttribute(name = "id", required = true)
    protected String id;
    @XmlAttribute(name = "href")
    @XmlSchemaType(name = "anyURI")
    protected String href;
    @XmlAttribute(name = "version", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar version;
    @XmlAttribute(name = "expires", required = true)
    @XmlSchemaType(name = "dateTime")
    protected XMLGregorianCalendar expires;
    @XmlAnyAttribute
    private Map<QName, String> otherAttributes = new HashMap<QName, String>();

    public String getNsa() {
        return nsa;
    }

    public void setNsa(String value) {
        this.nsa = value;
    }

    public String getType() {
        return type;
    }

    public void setType(String value) {
        this.type = value;
    }

    public AnyType getSignature() {
        return signature;
    }

    public void setSignature(AnyType value) {
        this.signature = value;
    }

    public AnyType getContent() {
        return content;
    }

    public void setContent(AnyType value) {
        this.content = value;
    }

    public List<Object> getAny() {
        if (any == null) {
            any = new ArrayList<Object>();
        }
        return this.any;
    }

    public String getId() {
        return id;
    }

    public void setId(String value) {
        this.id = value;
    }

    public String getHref() {
        return href;
    }

    public void setHref(String value) {
        this.href = value;
    }

    public XMLGregorianCalendar getVersion() {
        return version;
    }

    public void setVersion(XMLGregorianCalendar value) {
        this.version = value;
    }

    public XMLGregorianCalendar getExpires() {
        return expires;
    }

    public void setExpires(XMLGregorianCalendar value) {
        this.expires = value;
    }

    public Map<QName, String> getOtherAttributes() {
        return otherAttributes;
    }

}

0 个答案:

没有答案