All I can find are article and topics for " A descriptor with default root element <0> was not found in the project", i can't find anything on just "A descriptor for class <0> was not found in the project. " I had this original project that worked fine until we moved to 12c and now the marshalling of these is giving me this issue. I'm not great with JAXB and I don't even know what is exactly meant by "descriptor", they mean namespace? But I have working on this for days and I can't figure it out, any help would be greatly appreciated.
The command that causes the error(last line):
javax.xml.bind.Marshaller bindmarshaller = JAXBContext.newInstance(this.schema).createMarshaller();
StringWriter writer = new StringWriter();
bindmarshaller.marshal(header, new StreamResult(writer));
The plugin that binds the xmls:
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<removeOldOutput>true</removeOldOutput>
<schemaDirectory>
src/main/resources/
</schemaDirectory>
<includeSchemas>
<includeSchema>**/*.xsd</includeSchema>
</includeSchemas>
<includeBindings>
<includeBinding>**/*.xjb</includeBinding>
<includeBinding>**/jaxb-bindings.xml</includeBinding>
</includeBindings>
</configuration>
<dependencies>
<!-- JAxb api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<!-- JAxb impl - needed for deployment -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-xjc</artifactId>
<version>2.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
The xjb file that is bound:
<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0"
xmlns:jxb="<removed to post>"
xmlns:xs="<removed to post>">
<jxb:bindings schemaLocation="CSHeaderSchema.xsd" node="/xs:schema">
<jxb:schemaBindings>
<jxb:package name="<removed package>" />
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>
The schema:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Header" xmlns:xs="<removed to post>" version="1.0.0">
<xs:annotation>
<xs:documentation>
</xs:documentation>
</xs:annotation>
<xs:element name="CSHeader">
<xs:complexType>
<xs:sequence>
<xs:element name="MsgType" minOccurs="1">
...
</xs:schema>
The error I get:
javax.xml.bind.MarshalException
- with linked exception:
[Exception [EclipseLink-25007] (Eclipse Persistence Services - 2.4.2.v20130514-5956486): org.eclipse.persistence.exceptions.XMLMarshalException
Exception Description:
A descriptor for class <removed package>.CSHeader was not found in the project.
For JAXB, if the JAXBContext was bootstrapped using TypeMappingInfo[] you must call a marshal method that accepts TypeMappingInfo as an input parameter.