renaming a class results to "A Manager for test.MediaType is not declared."
error
---------------------------------------------------------------------------------
Key: JAXME-71
URL: http://issues.apache.org/jira/browse/JAXME-71
Project: JaxMe
Type: Bug
Versions: 0.5
Environment: Windows XP
JDK 1.5.0_04
JaxME 0.5
Reporter: Thomas Bielagk
Priority: Blocker
Suggest the following xsd file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<xs:annotation>
<xs:appinfo>
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:elementName suffix="Element"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</xs:appinfo>
</xs:annotation>
<xs:element name="Config">
<xs:complexType>
<xs:sequence>
<xs:element ref="Media" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element ref="MediaType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Media">
<xs:complexType>
<xs:attribute name="Text" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="MediaType">
<xs:annotation>
<xs:appinfo>
<jaxb:class name="MediaTyp"/>
</xs:appinfo>
</xs:annotation>
<xs:complexType>
<xs:attribute name="Text" type="xs:string"
use="required"/>
</xs:complexType>
</xs:element>
</xs:schema>
The problem with Media and MediaType is overlapping class names ==> solved by
renaming the MediaType class to MediaTyp ('e' removed).
Generation goes fine now, but when unmarshalling an xml document (java sample
below) I get an error:
Exception in thread "main" javax.xml.bind.UnmarshalException: A Manager for
test.MediaType is not declared.
at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:97)
at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:79)
at Main.main(Main.java:21)
Caused by:
org.xml.sax.SAXException: A Manager for test.MediaType is not declared.
at
org.apache.ws.jaxme.impl.JAXBContextImpl.getManagerS(JAXBContextImpl.java:240)
at test.impl.ConfigTypeHandler.startElement(ConfigTypeHandler.java:49)
at
org.apache.ws.jaxme.impl.JMUnmarshallerHandlerImpl.startElement(JMUnmarshallerHandlerImpl.java:195)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:533)
at
com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:220)
at
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:322)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1693)
at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
at
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
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:148)
at
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:92)
at
org.apache.ws.jaxme.impl.JMUnmarshallerImpl.unmarshal(JMUnmarshallerImpl.java:79)
at Main.main(Main.java:21)
The java code that produces the error:
JAXBContext context = JAXBContext.newInstance("test"); // test was the package
name I used to generate classes to
Unmarshaller um = context.createUnmarshaller();
Config conf = (Config)um.unmarshal(new File("sample.xml"));
I don't where exactly the error comes from or how to resolve it except of
renaming the xsd elements (without the jaxb-tags), but this isn't a suitable
solution.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]