Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » EclipseLink MOXy exception due to package structure
EclipseLink MOXy exception due to package structure [message #1067854] Wed, 10 July 2013 21:49 Go to next message
Tim Braun is currently offline Tim BraunFriend
Messages: 8
Registered: July 2013
Junior Member
I have this bindings file
<?xml version="1.0"?>
        <java-type name="com.test.Root">
            <xml-root-element name="root"/>
                <xml-element java-attribute="element" xml-path="element" type="com.Element"/>
        <java-type name="com.Element"></java-type>

The package structure and the class location are as can be read off this bindings file.
When I unmarshall I get the following exception. Can somebody tell me why and how I can solve the problem? I don't want to change my package structure.

    JAXBException: The java-type with package [com.test] is not allowed in the bindings file keyed on package [com].
Re: EclipseLink MOXy exception due to package structure [message #1076520 is a reply to message #1067854] Wed, 31 July 2013 14:15 Go to previous message
Blaise Doughan is currently offline Blaise DoughanFriend
Messages: 163
Registered: July 2009
Senior Member

You need to have one binding file per package. BTW when you specify the package name in the `xml-bindings` element you don't need to fully qualify the name on the `java-type` element.

When creating the JAXBContext on multiple binding files you can do the following:

List<String> mappingFiles = new ArrayList<String>(2);
Map<String, Object> properties = new HashMap<String, Object>(1);
properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, mappingFiles);
JAXBContext jaxbContext = JAXBContextFactory.createContext(new Class[] {Root.class}, properties);
Previous Topic:MOXy: Binding working and not working with 'same' XmlPath
Next Topic:EclipseLink MOXy: Logical operators in XmlPath annotation
Goto Forum:

Current Time: Thu Apr 26 06:14:06 GMT 2018

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

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