Hello Kohsuke & Sekhar,
I actually tried both approaches (passing list of package names and list of ObjectFactory classes to JAXBContext.newInstance), but to no avail. In both cases I keep getting the same error (see below).
It does not look as if JAXB had problems locating the class, it is something more subtle. Why is the @XmlRootElement annotation required for a nested element that is not the root of the schema?
Is there anything else I could try before I resort to stitching the XML instance "by hand"? Thank you for any tips.
Best regards,
Jan Moravec
[findlibdeps] Creating a new JAXBContext with classes: {class org.graphdrawing.g
raphml.xmlns.graphml.ObjectFactory, class com.yworks.xml.graphml.ObjectFactory}
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: Trying to locate org/graphdrawing/graphml/xmlns/graphml/jaxb.properties
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: not found
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: Trying to locate com/yworks/xml/graphml/jaxb.properties
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: not found
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: Checking system property javax.xml.bind.JAXBContext
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: not found
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: Checking META-INF/services
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder find
[findlibdeps] FINE: Reading jar:file:/c:/Java/e/lib/jaxb/jaxb-impl.jar!/META-INF
/services/javax.xml.bind.JAXBContext
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder newInstance
[findlibdeps] FINE: Trying to load com.sun.xml.bind.v2.ContextFactory
[findlibdeps] Jul 27, 2006 10:28:25 PM javax.xml.bind.ContextFinder newInstance
[findlibdeps] FINE: loaded com.sun.xml.bind.v2.ContextFactory from jar:file:/c:/
Java/e/lib/jaxb/jaxb-impl.jar!/com/sun/xml/bind/v2/ContextFactory.class
[findlibdeps] About to marshall object: javax.xml.bind.JAXBElement_at_a4488
[findlibdeps] Object is a JAXBElement, name={
http://graphml.graphdrawing.org/xmlns/graphml}graphml, type=class org.graphdrawing.graphml.xmlns.graphml.GraphmlType, scope=class javax.xml.bind.JAXBElement$GlobalScope, value=org.graphdrawing.graphml.xmlns.graphml.GraphmlType@19762f <mailto:value=org.graphdrawing.graphml.xmlns.graphml.GraphmlType@19762f>
[findlibdeps] Error marschalling dependency graph: javax.xml.bind.JAXBElement_at_a4488
[findlibdeps] javax.xml.bind.MarshalException
[findlibdeps] - with linked exception:
[findlibdeps] [com.sun.istack.SAXException2: unable to marshal type "com.yworks.xml.graphml.ShapeNodeType" as an element because it is missing an @XmlRootElement annotation]
[findlibdeps] at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:295)
[findlibdeps] at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:221)
[findlibdeps] at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:77)
-----Original Message-----
From: Kohsuke Kawaguchi [mailto:Kohsuke.Kawaguchi_at_Sun.COM]
Sent: Thu 7/27/2006 2:53 AM
To: users_at_jaxb.dev.java.net
Cc:
Subject: Re: No ObjectFactory with an @XmlElementDecl