Home » Language IDEs » Java Development Tools (JDT) » xml / xsd / JAXB problem(errors flagged in xinclude-linked .xml files, runs fine outside of Eclipse)
xml / xsd / JAXB problem [message #505798] |
Tue, 05 January 2010 00:16  |
Eclipse User |
|
|
|
Not sure if this is the right place for this question or not; please redirect me if not.
I've got several .xml files linked using xinclude, with an associated schema. The directory structure of the project is as follows:
bin
src
src-generated (JAXB generated files here)
schemas (.xsd files here)
xmldata (.xml files here)
The files are data read by a set of JAXB classes created from the .xsd file outside of Eclipse, using:
xjc DataSource.xsd -d ../src-generated -p com.xenblue... -verbose
This seems to work fine, and the generated classes work fine outside of Eclipse.
(Aside: There is, however, a line "unknown location" spit out by xjc prior to listing the generated classes. Not sure what that is about; hints?)
The files are generated outside of Eclipse because I couldn't see how to do it from within Eclipse (I'm using Workshop for Weblogic 10.3)
Each .xml file has a top element that looks something like this:
<zxb:dataSourceMaps xmlns:zxb="http://www.xenblue.com/DataSources"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://www.xenblue.com/DataSources
../schemas/DataSource.xsd ">
Note the "../schemas/DataSource.xsd"
In the xml editor, the top level file shows the following error for <xi:include> elements:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'xi:include'. One of '{"http://www.xenblue.com/DataSources":requestMaps}' is expected.
Included files show the following error on the top level element:
cvc-elt.1: Cannot find the declaration of element 'zxb:requestMaps'.
This looks like for some reason the .xsd file is not being found.
If the program is run from a command line, outside of Eclipse, it works fine -- JAXB classes load fine, and read all of the linked xml files fine.
However, an attempt to debug the project causes the project to crash with an NPE loading the JAXB generated classes:
Thread [main] (Suspended (exception NullPointerException))
ModelBuilder<T,C,F,M>.<clinit>() line: 125 [local variables unavailable]
JAXBContextImpl.getTypeInfoSet() line: 406
JAXBContextImpl.<init>(Class[], Collection<TypeReference>, Map<Class,Class>, String, boolean, RuntimeAnnotationReader, boolean, boolean) line: 270
ContextFactory.createContext(Class[], Collection<TypeReference>, Map<Class,Class>, String, boolean, RuntimeAnnotationReader, boolean, boolean) line: 103
ContextFactory.createContext(Class[], Map<String,Object>) line: 81
ContextFactory.createContext(String, ClassLoader, Map<String,Object>) line: 152
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
ContextFinder.newInstance(String, String, ClassLoader, Map) line: 133
ContextFinder.find(String, String, ClassLoader, Map) line: 299
JAXBContext.newInstance(String, ClassLoader, Map<String,?>) line: 372
JAXBContext.newInstance(String, ClassLoader) line: 337
XmlInfoSourceImpl.init() line: 159
XmlInfoSourceImpl.getDataSources() line: 138
InstitutionFactoryImpl.<clinit>() line: 120
InfoGatherer.<clinit>() line: 96
TestPatientRecord.testGetPatientSelectionInfo(String) line: 183
TestPatientRecord.main(String[]) line: 128
Interestingly, if I "run" it, as opposed to "debug" it, it also works fine within Eclipse. I presume this is because the NPE is trapped somewhere and ignored, and by some miracle everything else continues ok...
Can anyone give me some clues? I'd sure like to be able to debug this in Eclipse...
Thanks,
Gary
[Updated on: Tue, 05 January 2010 00:47] by Moderator
|
|
|
Re: xml / xsd / JAXB problem [message #506091 is a reply to message #505798] |
Tue, 05 January 2010 23:55  |
Eclipse User |
|
|
|
It appears that the NPE caused by JAXB is a caught exception, so by changing the NPE breakpoint to only handle uncaught NPE exceptions, one can debug this.
However, it doesn't resolve the problem of the xml files being flagged with errors.
|
|
|
Goto Forum:
Current Time: Mon Apr 14 18:32:35 EDT 2025
Powered by FUDForum. Page generated in 0.05648 seconds
|