Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Unmarshalling xml file with JAXB2.0 autogenerated class does not work in jdeveloper 11.1.1.9

OIM TEAM Tiger-ITFeb 2 2016 — edited Feb 3 2016

I am trying to get familiar with JAXB in jdeveloper. I am facing some problems. There are some test cases for which it works, for others it does not.

Case 1:

xml file is created manually. Respective java class for xmlelements is created manually. There is no ObjectFactory.java or jaxb.properties. Unmarshalling this xml file works fine.

Case 2:

xml file is not created manually. All respective java class including ObjectFactory.java and jaxb.properties are generated using jdeveloper "JAXB 2.0 Content Model from XML Schema" widget. I deleted ObjectFactory.java, jaxb.properties and package-info.java. Unmarshalling xml file with this class works fine.


Case 3:

Same as case 2 but this time I did not delete or modify anything generated and used as it is. It does not work. Throws the following error.

Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

javax.xml.bind.UnmarshalException

- with linked exception:

[Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.XMLMarshalException

Exception Description: A descriptor with default root element rss was not found in the project]

  at org.eclipse.persistence.jaxb.JAXBUnmarshaller.handleXMLMarshalException(JAXBUnmarshaller.java:816)

  at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:109)

  at com.example.jaxbintro.JAXBExampleClass.main(JAXBExampleClass.java:36)

Caused by: Exception [EclipseLink-25008] (Eclipse Persistence Services - 2.3.1.v20111018-r10243): org.eclipse.persistence.exceptions.XMLMarshalException

Exception Description: A descriptor with default root element rss was not found in the project

  at org.eclipse.persistence.exceptions.XMLMarshalException.noDescriptorWithMatchingRootElement(XMLMarshalException.java:129)

  at org.eclipse.persistence.internal.oxm.record.SAXUnmarshallerHandler.startElement(SAXUnmarshallerHandler.java:208)

  at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1598)

  at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:455)

  at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:401)

  at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:239)

  at org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:157)

  at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:688)

  at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:271)

  at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:258)

  at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:218)

  at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:306)

  at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:106)

  ... 1 more

The project is included in the attachment of this question. It is ready to run. More information in the comment of the java code. Main class is JAXBExampleClass.java.

What is wrong with Case 3?

This post has been answered by OIM TEAM Tiger-IT on Feb 3 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 2 2016
Added on Feb 2 2016
1 comment
2,950 views