异常摘要:
JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/D:/tomcat-6.0.18/webapps/xwiki/WEB-INF/lib/jaxb-impl-2.1.10.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
运行环境:
Jdk1.6+tomcat6.0.18+windows xp sp3+xwiki
详细的异常信息:
javax.servlet.ServletException: Servlet execution threw an exception
com.xpn.xwiki.wysiwyg.server.filter.XWikiContextInitializationFilter.doFilter(XWikiContextInitializationFilter.java:87)
com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:117)
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
root cause
java.lang.LinkageError: JAXB 2.0 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/D:/tomcat-6.0.18/webapps/xwiki/WEB-INF/lib/jaxb-impl-2.1.10.jar!/com/sun/xml/bind/v2/model/impl/ModelBuilder.class) needs 2.1 API. Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. (See http://java.sun.com/j2se/1.5.0/docs/guide/standards/)
com.sun.xml.bind.v2.model.impl.ModelBuilder.<clinit>(ModelBuilder.java:173)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:431)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:288)
com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1111)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
org.restlet.ext.jaxrs.internal.provider.AbstractJaxbProvider.getJaxbContext(AbstractJaxbProvider.java:63)
org.restlet.ext.jaxrs.internal.provider.AbstractJaxbProvider.marshal(AbstractJaxbProvider.java:84)
org.restlet.ext.jaxrs.internal.provider.JaxbProvider.writeTo(JaxbProvider.java:106)
org.restlet.ext.jaxrs.internal.wrappers.provider.SingletonProvider.writeTo(SingletonProvider.java:335)
org.restlet.ext.jaxrs.internal.util.JaxRsOutputRepresentation.write(JaxRsOutputRepresentation.java:105)
com.noelios.restlet.http.HttpServerCall.writeResponseBody(HttpServerCall.java:492)
com.noelios.restlet.http.HttpServerCall.sendResponse(HttpServerCall.java:428)
com.noelios.restlet.ext.servlet.ServletCall.sendResponse(ServletCall.java:407)
com.noelios.restlet.http.HttpServerConverter.commit(HttpServerConverter.java:391)
com.noelios.restlet.http.HttpServerHelper.handle(HttpServerHelper.java:148)
com.noelios.restlet.ext.servlet.ServerServlet.service(ServerServlet.java:881)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.xpn.xwiki.wysiwyg.server.filter.XWikiContextInitializationFilter.doFilter(XWikiContextInitializationFilter.java:87)
com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:117)
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:295)
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
罪魁祸首:
jaxb-impl-2.1.10.jar
jaxb-api-2.1.jar
解决方案:
在jdk6的环境中,若在web应用中使用以上两个jar包,你需要把jaxb-impl-2.1.10.jar放到jdk的lib目录下即可解决该异常