spring2.5+struts2 开发 昨天程序运行还是正常的 今天就出错
错误:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
经过调试 整理3种情况 出现这类问题
1.包的冲突
将spring.jar去掉,换成其他小的jar包,替代spring.jar.
2.修改配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
3.struts 配置 可能性比较小
struts.properties struts.objectFactory = spring
struts.xml <constant name="struts.objectFactory" value="spring" />
4.Myeclipse问题 加载包的顺序问题 就出现了有时候可以有时候出现这个错误。
我的现在已经不在出错。
错误:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from ServletContext resource [/WEB-INF/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
经过调试 整理3种情况 出现这类问题
1.包的冲突
将spring.jar去掉,换成其他小的jar包,替代spring.jar.
2.修改配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd">
3.struts 配置 可能性比较小
struts.properties struts.objectFactory = spring
struts.xml <constant name="struts.objectFactory" value="spring" />
4.Myeclipse问题 加载包的顺序问题 就出现了有时候可以有时候出现这个错误。
我的现在已经不在出错。