java.lang.NoSuchMethodError:org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar

时间:2011-09-25 11:57:04

标签: maven

当我尝试使用maven构建我的第一个项目时,我得到以下异常

SEVERE: Critical error during deployment: 
java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
    at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:594)
    at com.sun.faces.config.DbfFactory.initStatics(DbfFactory.java:248)
    at com.sun.faces.config.DbfFactory.<clinit>(DbfFactory.java:208)
    at com.sun.faces.config.ConfigManager$ParseTask.<init>(ConfigManager.java:893)
    at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:653)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:322)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
25/09/2011 02:40:15 م org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoSuchMethodError: org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar([Lorg/apache/xerces/xni/parser/XMLInputSource;)V
    at org.apache.xerces.jaxp.validation.XMLSchemaFactory.newSchema(Unknown Source)
    at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:594)
    at com.sun.faces.config.DbfFactory.initStatics(DbfFactory.java:248)
    at com.sun.faces.config.DbfFactory.<clinit>(DbfFactory.java:208)
    at com.sun.faces.config.ConfigManager$ParseTask.<init>(ConfigManager.java:893)
    at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:653)
    at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:322)
    at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)
    ... 15 more
25/09/2011 02:40:15 م org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
25/09/2011 02:40:15 م org.apache.catalina.core.StandardContext start
SEVERE: Context [/spring_faces] startup failed due to previous errors
25/09/2011 02:40:16 م org.icefaces.impl.push.servlet.ICEpushResourceHandler notifyContextShutdown
INFO: MainServlet not found in application scope: java.lang.NullPointerException
25/09/2011 02:40:16 م com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
    at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:894)
    at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:319)
    at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:112)
    at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:325)
    at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4011)
    at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4615)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4512)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
25/09/2011 02:40:16 م org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
25/09/2011 02:40:16 م org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: A web application registered the JBDC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
25/09/2011 02:40:16 م org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: A web application created a ThreadLocal with key of type [null] (value [javax.faces.context.FacesContext$1@678fb397]) and a value of type [com.sun.faces.config.InitFacesContext] (value [com.sun.faces.config.InitFacesContext@b57b39f]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.

1 个答案:

答案 0 :(得分:5)

显然,堆栈跟踪与maven无关。相反,它是部署Web应用程序的错误。

引自this可能相关的讨论主题。

  

你可能会从Xerces那里找到一个不兼容的类混合   2.8.1和一些旧版本的Xerces(2.7.0之前的东西)   在您的类路径上或者在背书目录中的某个位置   您的JDK 1.4安装。