欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

严重: Exception sending context initialized...org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from class p

程序员文章站 2022-11-22 09:51:34
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework ......

严重: exception sending context initialized event to listener instance of class org.springframework.web.context.contextloaderlistener
org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 6 in xml document from class path resource [applicationcontext.xml] is invalid; nested exception is org.xml.sax.saxparseexception; linenumber: 6; columnnumber: 33; 与元素类型 "class" 相关联的属性 "{1}" 应有左引号。
at org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:399)
at org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:336)
at org.springframework.beans.factory.xml.xmlbeandefinitionreader.loadbeandefinitions(xmlbeandefinitionreader.java:304)
at org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:181)
at org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:217)
at org.springframework.beans.factory.support.abstractbeandefinitionreader.loadbeandefinitions(abstractbeandefinitionreader.java:188)
at org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:125)
at org.springframework.web.context.support.xmlwebapplicationcontext.loadbeandefinitions(xmlwebapplicationcontext.java:94)
at org.springframework.context.support.abstractrefreshableapplicationcontext.refreshbeanfactory(abstractrefreshableapplicationcontext.java:129)
at org.springframework.context.support.abstractapplicationcontext.obtainfreshbeanfactory(abstractapplicationcontext.java:609)
at org.springframework.context.support.abstractapplicationcontext.refresh(abstractapplicationcontext.java:510)
at org.springframework.web.context.contextloader.configureandrefreshwebapplicationcontext(contextloader.java:446)
at org.springframework.web.context.contextloader.initwebapplicationcontext(contextloader.java:328)
at org.springframework.web.context.contextloaderlistener.contextinitialized(contextloaderlistener.java:107)
at org.apache.catalina.core.standardcontext.listenerstart(standardcontext.java:4973)
at org.apache.catalina.core.standardcontext.startinternal(standardcontext.java:5467)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:150)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)
at java.util.concurrent.futuretask.run(unknown source)
at java.util.concurrent.threadpoolexecutor.runworker(unknown source)
at java.util.concurrent.threadpoolexecutor$worker.run(unknown source)
at java.lang.thread.run(unknown source)
caused by: org.xml.sax.saxparseexception; linenumber: 6; columnnumber: 33; 与元素类型 "class" 相关联的属性 "{1}" 应有左引号。
at com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.createsaxparseexception(unknown source)
at com.sun.org.apache.xerces.internal.util.errorhandlerwrapper.fatalerror(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlerrorreporter.reporterror(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlscanner.reportfatalerror(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlscanner.scanattributevalue(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanattribute(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.scanstartelement(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl$fragmentcontentdriver.next(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmldocumentscannerimpl.next(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmlnsdocumentscannerimpl.next(unknown source)
at com.sun.org.apache.xerces.internal.impl.xmldocumentfragmentscannerimpl.scandocument(unknown source)
at com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(unknown source)
at com.sun.org.apache.xerces.internal.parsers.xml11configuration.parse(unknown source)
at com.sun.org.apache.xerces.internal.parsers.xmlparser.parse(unknown source)
at com.sun.org.apache.xerces.internal.parsers.domparser.parse(unknown source)
at com.sun.org.apache.xerces.internal.jaxp.documentbuilderimpl.parse(unknown source)
at org.springframework.beans.factory.xml.defaultdocumentloader.loaddocument(defaultdocumentloader.java:76)
at org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloaddocument(xmlbeandefinitionreader.java:429)
at org.springframework.beans.factory.xml.xmlbeandefinitionreader.doloadbeandefinitions(xmlbeandefinitionreader.java:391)
... 22 more

三月 07, 2020 12:11:21 下午 org.apache.catalina.core.standardcontext startinternal
严重: error listenerstart
三月 07, 2020 12:11:21 下午 org.apache.catalina.core.standardcontext startinternal
严重: context [/ssh_crm] startup failed due to previous errors
三月 07, 2020 12:11:21 下午 org.apache.catalina.core.applicationcontext log
信息: closing spring root webapplicationcontext
三月 07, 2020 12:11:21 下午 org.apache.catalina.core.standardcontext listenerstop
严重: exception sending context destroyed event to listener instance of class org.springframework.web.context.contextloaderlistener
java.lang.illegalstateexception: beanfactory not initialized or already closed - call 'refresh' before accessing beans via the applicationcontext
at org.springframework.context.support.abstractrefreshableapplicationcontext.getbeanfactory(abstractrefreshableapplicationcontext.java:170)
at org.springframework.context.support.abstractapplicationcontext.destroybeans(abstractapplicationcontext.java:1006)
at org.springframework.context.support.abstractapplicationcontext.doclose(abstractapplicationcontext.java:982)
at org.springframework.context.support.abstractapplicationcontext.close(abstractapplicationcontext.java:934)
at org.springframework.web.context.contextloader.closewebapplicationcontext(contextloader.java:583)
at org.springframework.web.context.contextloaderlistener.contextdestroyed(contextloaderlistener.java:116)
at org.apache.catalina.core.standardcontext.listenerstop(standardcontext.java:5014)
at org.apache.catalina.core.standardcontext.stopinternal(standardcontext.java:5659)
at org.apache.catalina.util.lifecyclebase.stop(lifecyclebase.java:232)
at org.apache.catalina.util.lifecyclebase.start(lifecyclebase.java:160)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1559)
at org.apache.catalina.core.containerbase$startchild.call(containerbase.java:1549)
at java.util.concurrent.futuretask.run(unknown source)
at java.util.concurrent.threadpoolexecutor.runworker(unknown source)
at java.util.concurrent.threadpoolexecutor$worker.run(unknown source)
at java.lang.thread.run(unknown source)

原因:此类错误注意看报错提示。异常来自类路径资源[applicationcontext.xml]的xml文档中的第6行无效;嵌套异常为org.xml.sax.saxparseexception;行号:6;多生成一个标签。

附上错误原码:

<!-- action -->
<bean name="useraction" class="cn.itcast.web.action.useraction" ></bean>
<!-- service -->
<bean name="userservice" class=<element>"cn.itcast.service.impl.userserviceimpl"</element>></bean>