Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works
JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works [message #1092049] Thu, 22 August 2013 09:07 Go to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Hello,

I have generated Java classes from a xsd file using jaxb-compiler
then while unmarshalling a valid xml file (against same xsd), I have stack trace provided above.

By debugging the code it seems that as xml is "human readable" meaning like this

<tag>
<subtag/>
<tag>

eclipselink wrongly try to bind "/n/t" instead of binding subtag directly

If I unmarshall using same xml and same generated java with JAXB RI, it works as expected,
Do you have an idea on what could be the problem, and how I could solve it ?

Local Exception Stack:
Exception [EclipseLink-3002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [], of class [class java.lang.String], from mapping [org.eclipse.persistence.oxm.mappings.XMLDirectMapping[complexAtomicAttributeTemplate-->complexAtomicAttributeTemplate/text()]] with descriptor [XMLDescriptor(test.gen.moxy.ComplexViewAttributeDefinition --> [])], could not be converted to [class test.gen.moxy.TplComplexAtomicAttr].
at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:71)
at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:169)
at org.eclipse.persistence.internal.oxm.XMLConversionManager.convertObject(XMLConversionManager.java:183)
at org.eclipse.persistence.internal.databaseaccess.DatasourcePlatform.convertObject(DatasourcePlatform.java:160)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.getAttributeValue(XMLDirectMapping.java:293)
at org.eclipse.persistence.internal.oxm.XMLDirectMappingNodeValue.endElement(XMLDirectMappingNodeValue.java:182)
at org.eclipse.persistence.oxm.record.UnmarshalRecord.startElement(UnmarshalRecord.java:635)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2717)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
at org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:157)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:753)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:333)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:320)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:280)
at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:306)
at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:115)

[Updated on: Thu, 22 August 2013 09:09]

Report message to a moderator

Re: JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works [message #1092352 is a reply to message #1092049] Thu, 22 August 2013 17:11 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

Could you post the model you are mapping that XML to?

-Blaise
Re: JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works [message #1092834 is a reply to message #1092352] Fri, 23 August 2013 08:53 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Hello, thanks for the reply.

After more tests, I am probably facing a bug that has been fixed, becauseI cannot reproduce the issue with eclipselink 2.5.0.
The thing is I am stuck with 2.3.2 currently because my code is supposed to run in weblogic 12c that expose eclipselink 2.3.2 as JAXB provider, so I am wondering if there is any way to workaround this issue by some anotations or some properties

I attach a sample project, with the xsd I used to generate classes with and a xml file.
To reproduce the issue, you have to copied eclipselink.jar in lib (too big to be attached with)
launcher launch reproduces the issue.

Best Regards,
Arnaud
  • Attachment: test.moxy.zip
    (Size: 89.90KB, Downloaded 254 times)
Re: JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works [message #1093082 is a reply to message #1092352] Fri, 23 August 2013 14:39 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

Hi Arnaud,

The bug you are hitting was also fixed in the EclipseLink 2.3.3 stream:
- http://www.eclipse.org/eclipselink/downloads/previous_releases.php

I ran your test case and was able to get the same exception as you when using EclipseLink 2.3.2. You can change the way you create your JAXBContext to get your use case to work. In general when creating a JAXBContext on a model generated from an XML schema I recommend one of the following two ways to ensure you get everything you need to processed.

Option #1 - Create JAXBContext on Package Name
JAXBContext jaxbContext = JAXBContext.newInstance("test.moxy");


Option #2 - Create JAXBContext on ObjectFactory Class
JAXBContext jaxbContext = JAXBContext.newInstance(test.moxy.ObjectFactory.class);

-Blaise
JAXB : EclipseLink-3002 while unmarshalling xml error , but schmea validation passes [message #1403778 is a reply to message #1092049] Sun, 27 July 2014 00:23 Go to previous message
chandra kotha is currently offline chandra kothaFriend
Messages: 1
Registered: July 2014
Junior Member
Thanks i got it resloved.

[Updated on: Mon, 22 June 2015 17:49]

Report message to a moderator

Previous Topic:Running JPA entity with native queries from TestNG
Next Topic:JPA Generate Entities from Tables fails
Goto Forum:
  


Current Time: Thu Apr 25 15:22:33 GMT 2024

Powered by FUDForum. Page generated in 0.03763 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top