问题描述
INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - [Loading XML bean definitions from ServletContext resource [/WEB-INF/classes/applicationContext.xml]]ERROR [org.springframework.web.context.ContextLoader] - [Context initialization failed]org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/classes/applicationContext.xml]; nested exception is java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setAttribute(Ljava/lang/String;Ljava/lang/Object;)Vat org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:987)at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:909)at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:495)at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1206)at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:314)at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)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:516)at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)at org.apache.catalina.startup.Catalina.start(Catalina.java:583)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:288)at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)Caused by: java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setAttribute(Ljava/lang/String;Ljava/lang/Object;)Vat org.springframework.beans.factory.xml.DefaultDocumentLoader.createDocumentBuilderFactory(DefaultDocumentLoader.java:99)at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:70)at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)... 37 more2011-8-30 17:05:38 org.apache.catalina.core.StandardContext listenerStart折腾2天还没解决 谢谢帮忙 问题补充:包的截图 ,一次截不完,就截了4张,里面用到了一些本体(Ontology)包包的截图
解决方案
xml-apis.jarxerces.jar中都有这个类,应该是冲突了,你这么多框架依赖,估计不好办呐
解决方案二:
解决办法是: 1.去掉类路径上的关于Hibernate的3个lib asm.jar asm-attrs.jar cglib-2.1.3.jar 2.加入Spring中的以下4个lib asm-2.2.2.jar asm-commons-2.2.2.jar asm-util-2.2.2.jar cglib-nodep-2.1_3.jar
解决方案三:
有包没有导入 把你的applicationxml贴出来看看的。
解决方案四:
xml-apis.jar xerces.jar xmlParserAPIs.jar都有冲突的类
解决方案五:
spring配置文件的格式有问题,不符合规范,解析不了了。
解决方案六:
这些jar包里都有DocumentBuilderFactory类,找找你的有没有冲突的abstract class javax.xml.parsers.DocumentBuilderFactory [2340 bytes, jvm >= 1.4 ]rt.jarabstract class javax.xml.parsers.DocumentBuilderFactory [3575 bytes, jvm >= 1.5 ]rt.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2816 bytes, jvm >= 1.1 ]PullParser2.jarpull-parser-2.jarabstract class javax.xml.parsers.DocumentBuilderFactory [3232 bytes, jvm >= 1.1 ]xml-apis.jarxml-apis.jarxml-apis-1.3.02.jarclient.jarxml-apis-1.3.03.jarjavaee-api-5.0.4.jarjavaee-api-5.0.5.jarjavaee-api-5.0.3.jarjavaee-api-5.1.0-M1.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2015 bytes, jvm >= 1.1 ]xml-apis.jarxmlParserAPIs.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2043 bytes, jvm >= 1.2 ]piccolo-1.03.jarpiccolo-1.0.3.jarabstract class javax.xml.parsers.DocumentBuilderFactory [1986 bytes, jvm >= 1.2 ]xml-apis-1.0.b2.jarxml-apis-2.0.0.jarxml-apis-2.0.2.jarexcalibur-fortress-container-complete-1.1.jaravalon-fortress-container-complete-1.1.jardata-management-cli-1.1-beta-2-app.jardata-management-cli-1.1-app.jardata-management-cli-1.1-beta-4-app.jardata-management-cli-1.1-beta-3-app.jarcontinuum-xmlrpc-backup-1.1-app.jardata-management-cli-1.2-app.jarcontinuum-xmlrpc-backup-1.2-app.jarbokobai-1.0-all.jareasybeans-uberjar-hibernate-1.1.0-M1.jareasybeans-uberjar-hibernate-1.1.0-M2.jardata-management-cli-1.2.2-app.jarcontinuum-xmlrpc-backup-1.2.2-app.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2817 bytes, jvm >= 1.1 ]crimson.jarcrimson-1.1.3.jarcrimson.jarabstract class javax.xml.parsers.DocumentBuilderFactory [1959 bytes, jvm >= 1.1 ]xml-apis.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2011 bytes, jvm >= 1.1 ]xml-apis.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2067 bytes, jvm >= 1.1 ]xml-apis.jarxmlParserAPIs-2.6.0.jarxmlParserAPIs-2.6.2.jarxmlParserAPIs-2.6.1.jargwt-dev-1.4.62-mac.jargwt-dev-1.4.62-linux.jargwt-dev-1.4.62-windows.jargwt-dev-1.4.62-leopard.jarjavaee-api-5.0.2.jarjavaee-api-5.0.1.jarjavaee-api-5.0.0.jarxmlParserAPIs-2.2.1.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2068 bytes, jvm >= 1.1 ]jaxp-api.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2237 bytes, jvm >= 1.1 ]gnujaxp-1.0.0.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2360 bytes, jvm >= 1.1 ]aspectjtools-1.2rc1.jaraspectjtools-1.2.jaraspectjtools-1.1.1.jaraspectjtools-1.1.0.jarxmlParserAPIs-2.0.0.jarxmlParserAPIs-2.0.2.jarabstract class javax.xml.parsers.DocumentBuilderFactory [4786 bytes, jvm >= 1.1 ]devtools-1.1-all.jarxerces-1.2.3.jarabstract class javax.xml.parsers.DocumentBuilderFactory [4513 bytes, jvm >= 1.5 ]jaxp-api-1.4.jarabstract class javax.xml.parsers.DocumentBuilderFactory [4170 bytes, jvm >= 1.2 ]jaxp-api-1.3.jarabstract class javax.xml.parsers.DocumentBuilderFactory [5926 bytes, jvm >= 1.1 ]saxon-6.5.3.jarabstract class javax.xml.parsers.DocumentBuilderFactory [5532 bytes, jvm >= 1.1 ]saxon-6.5.2.jarabstract class javax.xml.parsers.DocumentBuilderFactory [2332 bytes, jvm >= 1.1 ]xerces-1.4.4.jarabstract class javax.xml.parsers.DocumentBuilderFactory [4945 bytes, jvm >= 1.1 ]xerces-1.4.0.jarabstract class javax.xml.parsers.DocumentBuilderFactory [3115 bytes, jvm >= 1.1 ]xml-apis-1.3.04.jar
解决方案七:
Caused by: java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setAttribute(Ljava/lang/String;Ljava/lang/Object;)V DocumentBuilderFactory里的setAttribute方法是abstract的,应该是加了含有javax.xml.parsers.DocumentBuilderFactory类的jar包导致的
解决方案八:
应该是你的xml文件的问题,把applicationContext.xml贴出来看看。
解决方案九:
也把applicationContext.xml源码放出来吧
解决方案十:
包冲突吧 把你包的截图发出来。