如题,我的MyEclipse版本是8.6的,Java版本是1.6.21的,Struts是2.2.1的
下面是Tomcat的问题描述
警告: Could not create JarEntryRevision for [jar:file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/lib/struts2-core-2.2.1.jar]!
java.lang.NoClassDefFoundError: org/apache/commons/io/output/NullOutputStream
。
严重: Premature end of file. at (null:2:1)
org.xml.sax.SAXParseException: Premature end of file.
严重: Dispatcher initialization failed
Unable to load configuration. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: Unable to load file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: Premature end of file. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: org.xml.sax.SAXParseException: Premature end of file.
严重: Exception starting filter struts2
Unable to load configuration. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
下面是我的struts.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!--指定全局国际化资源文件 base名-->
<constant name="struts.custom.i18n.resources" value="messageResource"/>
<!--指定国际化编码所使用的字符集-->
<constant name="struts.il8n.encoding" value="GBK"/>
</struts>
还有web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--定义Struts 2的FilterDispatcher的Filter-->
<filter>
<!--定义核心Filter的名字-->
<filter-name>struts2</filter-name>
<!--定义核心Filter的实现类-->
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<!--FilterDispatcher用来初始化Struts 2并且处理所有请求-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
请问是怎么回事啊
下面是Tomcat的问题描述
警告: Could not create JarEntryRevision for [jar:file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/lib/struts2-core-2.2.1.jar]!
java.lang.NoClassDefFoundError: org/apache/commons/io/output/NullOutputStream
。
严重: Premature end of file. at (null:2:1)
org.xml.sax.SAXParseException: Premature end of file.
严重: Dispatcher initialization failed
Unable to load configuration. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: Unable to load file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: Premature end of file. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
Caused by: org.xml.sax.SAXParseException: Premature end of file.
严重: Exception starting filter struts2
Unable to load configuration. - file:/D:/Server/apache-tomcat-7.0.0/webapps/webDemo/WEB-INF/classes/struts.xml:2:1
下面是我的struts.xml
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<!--指定全局国际化资源文件 base名-->
<constant name="struts.custom.i18n.resources" value="messageResource"/>
<!--指定国际化编码所使用的字符集-->
<constant name="struts.il8n.encoding" value="GBK"/>
</struts>
还有web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!--定义Struts 2的FilterDispatcher的Filter-->
<filter>
<!--定义核心Filter的名字-->
<filter-name>struts2</filter-name>
<!--定义核心Filter的实现类-->
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<!--FilterDispatcher用来初始化Struts 2并且处理所有请求-->
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
请问是怎么回事啊
2. 检查你的struts2的那个jar包是否是正常的
另外你们说的jar包冲突怎么看,还有我的structs.xml放在classes目录下,有问题吗
2. 检查你的struts2的那个jar包是否是正常的
我用的包分别是:
commons-logging-1.0.4.jar
freeer-2.3.16.jar
ognl-3.0.jar
xwork-core-2.2.1.jar
struts2-core-2.2.1.jar
就放在我开发的程序路径的lib下面
Tomcat下的lib我没放
请问大家是什么问题啊,真的是版本问题吗
1.我在Installed JREs设置了jdk1.0.0_21路径
2.在这里我又jre6的路径
3.我在MyEclipse选项下设置了TomCat7.x的server为Enalble
4.新建一个Web项目,把commons-logging-1.0.4.jar
freeer-2.3.16.jar
ognl-3.0.jar
xwork-core-2.2.1.jar
struts2-core-2.2.1.jar包放进该项目的lib里
5.然后编写struts.xml,web.xml及相关程序
这样配置对吗
commons-io-1.3.2.jar
把这两个包放进去,我用的版本跟你的不一样,加入版本跟你的struts相配的这两个包
看看会不会好
commons-io-1.3.2.jar这两个包,其它的又写了一遍,这次可以了,当是我还是不清楚原因,早知道原来的留着对比一下,汗,期待高手帮我解疑
大哥 这都看不出来啊 晕 缺IO包啦 在Struts 里面找去
高手们知道用这几个版本有什么禁忌吗?
commons-logging-1.0.4.jar
freeer-2.3.16.jar
ognl-3.0.jar
struts2-core-2.2.1.jar
xwork-core-2.2.1.jar
有冲突吗?
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
改完后, 重新部署到Tomcat上,OK! 我刚刚解决的!