jAXB problems - please help
Howdy
I have an EAR project deployed in jboss. The ear file contains an EJB jar file, which houses the XJC generated classes in addition to the EJB. The ear file also includes 2 war files
Each war file contains 1 servlet.
The issue is that the servlet from war 1 fails and the servlet from war2 succeeds, YET THEY ARE COPIES OF EACH OTHER
Here are the datials from a failure/success perspective
servlet from War that SUCCEEDS
1)WEB-INF/lib containsa set of jars (call it setx), AND the EJB jar containing the XJC generated classes
2)the mainfest.mf (classpath) has all the above jars including the EJB listed (generated from Maven2) - this means the EJB jar file is in the EAR and this wars WEB-INF/lib
3) When the servlet runs, i print out the to_string method of the jaxbContext, and it shows ALL the specific XJC generated classes except for the ObjectFactory
Servlet from WAR that FAILS
1)WEB-INF/lib contains ONLY set of jars, setx (see above)
2)the mainfest.mf (classpath) has all the above jars including the EJB listed (generated from Maven2)
3)When the servlet runs, i print out the to_string method of the jaxbContext, and it shows ONLY the ObjectFactory generated by XJC
The servlet code FOR BOTH SERVLETS is:
JAXBContext jaxbContext_tst = JAXBContext.newInstance(FIRST_AMERICAN_RESPONSE);
System.out.println(jaxbContext_tst.toString());
Unmarshaller unmarshaller_tst = jaxbContext_tst.createUnmarshaller();
unmarshaller_tst.setEventHandler(new javax.xml.bind.helpers.DefaultValidationEventHandler());
RESPONSEGROUP tst = (RESPONSEGROUP) unmarshaller_tst.unmarshal(new File( "C:\\homeq-maven\\projects\\homeq-bpo\\notes\\resptest.xml" ));
In the success servlet, tst contains all the data, in the failing servlet, an unmarshal exception is thrown
The unmarshalexception I get when call unmarshal(...) is:
17:08:18,827 INFO [STDOUT] DefaultValidationEventHandler: [FATAL_ERROR]: unexpected element (uri:"", local:"RESPONSE_GROUP"). Expected elements are (none)
Location: line 1 of file:/C:/homeq-maven/projects/homeq-bpo/notes/resptest.xml
17:08:22,093 ERROR [STDERR] javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"RESPONSE_GROUP"). Expected elements are (none)
17:08:22,093 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:556)
17:08:22,093 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:199)
17:08:22,093 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:194)
17:08:22,093 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:71)
17:08:22,093 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:957)
17:08:22,108 ERROR [STDERR] at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:399)
Given that the EAR file contains the EJB jar file containing the XJC generated classes, AND the manifest.mf file lists the EJB jar (I believe this puts it in the classpath), then why is the failing servlet failing?

