Hi,
I just upgraded to the latest JAXB. I got the samples working, but code I
had working before doesn't work any more. I'm calling this method:
/**
* Reads a JAXB object from an InputStream.
*/
public static Object unmarshal (InputStream in)
throws IOException, JAXBException, ValidationException
{
Object unmarshalledObject = null;
try {
JAXBContext jc =
JAXBContext.newInstance("org.nwu.sesp.pdl");
Unmarshaller u = jc.createUnmarshaller();
File f = new File(
System.getProperty("user.dir") + File.separatorChar
+ "sampleUser" + File.separatorChar
+ "1myWork9.xml");
if (!f.exists()) {
throw new IOException("couldn't find file " +
f.getAbsolutePath());
}
FileInputStream fis = new FileInputStream(f);
unmarshalledObject = u.unmarshal(fis);
} catch( JAXBException je ) {
je.printStackTrace();
} catch( IOException ioe ) {
ioe.printStackTrace();
}
return unmarshalledObject;
// return(unmarshaller.unmarshal(in));
}
and getting this output:
ReflectionToolMgr.unmarshal:unmarshaller is a
org.nwu.sesp.pdl.impl.runtime.UnmarshallerImpl
TemplateImpl.createUnmarshaller:context is a
org.nwu.sesp.pdl.impl.runtime.SAXUnmarshallerHandlerImpl
java.lang.VerifyError: (class:
org/nwu/sesp/pdl/impl/TemplateImpl$Unmarshaller, method: <init> signature:
(Lorg/nwu/sesp/pdl/impl/TemplateImpl;Lorg/nwu/sesp/pdl/impl/runtime/UnmarshallingContext;I)V)
Expecting to find object/array on stack
at
org.nwu.sesp.pdl.impl.TemplateImpl.createUnmarshaller(TemplateImpl.java:33)
at
org.nwu.sesp.pdl.ObjectFactory$GrammarInfoImpl.createUnmarshaller(ObjectFactory.java:352)
at
org.nwu.sesp.pdl.impl.runtime.SAXUnmarshallerHandlerImpl.startElement(SAXUnmarshallerHandlerImpl.java:112)
at
org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java:1376)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1214)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumentScanner.java:1806)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:949)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at
org.nwu.sesp.pdl.impl.runtime.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:142)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:131)
at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:178)
at
org.nwu.sesp.reflectionTool.ReflectionToolMgr.unmarshal(ReflectionToolMgr.java:114)
...
Any ideas on how I can figure out what's wrong? I deleted all
xjc-generated files before I created my new set. I keep all my jar files
in a folder in my project, so I had to copy .jar files from the JAXB
installation to my folder. I copied all the jar files listed in the JAXB docs:
jaxb/lib
jaxb-api.jar
jaxb-xjc.jar
jaxb-impl.jar (removed jaxb-ri.jar)
jaxb-libs.jar
jaxp/lib & jaxp/lib/endorsed
jaxp-api.jar
sax.jar
dom.jar
xercesImpl.jar
xalan.jar
other jar files
jax-qname.jar (contained in jwsdp-1.2/jwsdp-shared/lib)
namespace.jar (contained in jwsdp-1.2/jwsdp-shared/lib)
xsdlib.jar (contained in jwsdp-1.2/jwsdp-shared/lib)
relaxngDatatype.jar (contained in jwsdp-1.2/jwsdp-shared/lib)
ant.jar (contained in apache-ant/lib)
I set my classpath with these jar files at the beginning of the path in the
order above, except that I put relaxngDatatype.jar ahead of jaxb-libs.jar.
--TJ
TJ Leone
School of Education and Social Policy
Northwestern University
2120 Campus Drive
Evanston, IL 60208-2610
Phone: 847/467-2819
Fax: 847/491-8999