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 05:07 Go to next message
Arnaud MERGEY is currently offline Arnaud MERGEY
Messages: 128
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 05: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 13:11 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise Doughan
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 04:53 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEY
Messages: 128
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
Re: JAXB : EclipseLink-3002 while unmarshalling xml even JAXB RI works [message #1093082 is a reply to message #1092352] Fri, 23 August 2013 10:39 Go to previous messageGo to next message
Blaise Doughan is currently offline Blaise Doughan
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] Sat, 26 July 2014 20:23 Go to previous message
chandra kotha is currently offline chandra kotha
Messages: 1
Registered: July 2014
Junior Member
Hi

I am also getting below un-marshalling error .. any help?

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[bcbsaAlphaPrefixCode-->ns70:BCBSAAlphaPrefixCode/text()]] with descriptor [XMLDescriptor(com.xxx.schema.member.v4.MemberSummary --> [])], could not be converted to [class com.xxx.schema.codetypes.v2.BCBSAAlphaPrefixCode].
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.endElement(UnmarshalRecord.java:831)
at com.sun.org.apache.xerces.internal.jaxp.validation.ValidatorHandlerImpl.endElement(ValidatorHandlerImpl.
Previous Topic:Cache coordination with tomcat 6
Next Topic:Running JPA entity with native queries from TestNG
Goto Forum:
  


Current Time: Mon Jul 28 20:41:41 EDT 2014

Powered by FUDForum. Page generated in 0.09462 seconds