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开发者_JAVA技巧.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.
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());
It appears you're deserializing a SOAP message. You can enable HTTP debugging by adding -Djavax.net.debug=all
to your JVM options. That'll dump the incoming message. Once you can see your input, make sure the start and end tags match (as per the second part of the error message).
JAXBContext context = JAXBContext.newInstance(jaxbObjectClass);
Unmarshaller unmarshaller = context.createUnmarshaller();
unmarshaller.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
I'd suggest you to create exception breakpoint on XMLStreamException. At least eclipse allows this. So you will be able to see the point where the exception is thrown. probably it will help.
BTW I am not sure that 1, 1127 is completely wrong. First check (just in case) that you do not have something illegal in this position. Second, check that it is not the 1127'th character of your file. If for example the file was generated on Unix where line separator is \n but you run code on Windows where line separator is \r\n the system probably does not recognize the line breaks, so it thinks that your XML is formatted as a very long single line.
精彩评论