JAXP IllegalAnnotationExceptions

时间:2011-08-27 11:03:58

标签: java xml debugging xerces jaxp

JAXP给了我这个错误

10 counts of IllegalAnnotationExceptions

有没有办法找出这10个错误的位置?如果我引用我的一些代码,我可以将其归结为7个错误,但这是最愚蠢的调试方式......

我可以像使用DOM一样注册一些ErrorHandler吗?

我的代码如下所示:

DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
dbFactory.setNamespaceAware( true);
dbFactory.setValidating(true);
dbFactory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
dBuilder.setErrorHandler(logger);
Document doc = dBuilder.parse(file);
JAXBContext jc= JAXBContext.newInstance(Config.class); // Here exception is thrown
Unmarshaller u = jc.createUnmarshaller();
Config config =  (Config) u.unmarshal(doc);

编辑:

这是堆栈跟踪,但它并没有真正告诉我错误的位置。

  

消息:IllegalAnnotationExceptions的10个计数   com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException $ Builder.check(未知来源)   com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(未知来源)   com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl。(未知来源)   com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl $ JAXBContextBuilder.build(未知来源)   com.sun.xml.internal.bind.v2.ContextFactory.createContext(未知来源)   com.sun.xml.internal.bind.v2.ContextFactory.createContext(未知来源)   sun.reflect.NativeMethodAccessorImpl.invoke0(原生方法)   sun.reflect.NativeMethodAccessorImpl.invoke(未知来源)   sun.reflect.DelegatingMethodAccessorImpl.invoke(未知来源)   java.lang.reflect.Method.invoke(未知来源)   javax.xml.bind.ContextFinder.newInstance(未知来源)   javax.xml.bind.ContextFinder.find(未知来源)   javax.xml.bind.JAXBContext.newInstance(未知来源)   javax.xml.bind.JAXBContext.newInstance(未知来源)

0 个答案:

没有答案