开发者

JAXP IllegalAnnotationExceptions

JAXP gives me this error

10 counts of IllegalAnnotationExceptions

Is there any way of finding out where these 10 errors are? If I quote some of my code I can get it down to 7 errors, but that is the most idiotic way of debugging...

Can I register some ErrorHandler like you can do with DOM?

My code looks like this:

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);

EDIT:

Here is the stack trace, but it doesn't really tell开发者_如何学Go my where the errors are.

Message: 10 counts of IllegalAnnotationExceptions com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source) com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source) com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.(Unknown Source) com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source) com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) java.lang.reflect.Method.invoke(Unknown Source) javax.xml.bind.ContextFinder.newInstance(Unknown Source) javax.xml.bind.ContextFinder.find(Unknown Source) javax.xml.bind.JAXBContext.newInstance(Unknown Source) javax.xml.bind.JAXBContext.newInstance(Unknown Source)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜