Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug marshaling in JAXB?

During marshaling I got next exception

Exception in thread "main" com.sun.xml.internal.ws.encoding.soap.DeserializationException: Failed to read a response: javax.xml.bind.UnmarshalException
 - with linked exception:
[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,1127]
Message: XML document structures must start and end within the same entity.]

so I want see xml where [row,col]:[1,1127] is located. Please suggest.

like image 832
user590444 Avatar asked Jul 13 '11 14:07

user590444


People also ask

How does JAXB marshalling work?

In JAXB, marshalling involves parsing an XML content object tree and writing out an XML document that is an accurate representation of the original XML document, and is valid with respect the source schema. JAXB can marshal XML data to XML documents, SAX content handlers, and DOM nodes.

What is JAXB marshalling?

JAXB stands for Java Architecture for XML Binding. It provides mechanism to marshal (write) java objects into XML and unmarshal (read) XML into object. Simply, you can say it is used to convert java object into xml and vice-versa.

What is marshalling and unmarshalling in JAXB?

JAXB definitionsMarshalling is the process of transforming Java objects into XML documents. Unmarshalling is the process of reading XML documents into Java objects. The JAXBContext class provides the client's entry point to the JAXB API. It provides API for marshalling, unmarshalling and validating.

What is marshaling and Unmarshalling in Java?

Marshalling is the process of writing Java objects to XML file. Unmarshalling is the process of converting XML content to Java objects.


1 Answers

You can see JAXB debug output in the console by specifying -Djaxb.debug=true in the JVM options. Additionally you may want to set an event handler on the unmarshaller: unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());

like image 199
Werner Altewischer Avatar answered Sep 17 '22 05:09

Werner Altewischer