struts 2运行和配置中出现错误
2011-03-24 02:14
281 查看
调试struts程序。出现下面错误。
错误:
type Status report
message /Struts2/
description The requested resource (/Struts2/) is not available.
其中:web.xml中配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts 2.0 StrutsDemo</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
一开始没有进行web.xml配置时候,可以正常运行建立的jsp文件,但是添加了filter过滤器和过滤器映射后,却不能运行。经过检查,其他action文件,struts.xml文件配置均没有错误。后面着重对web。xml进行分析,觉得问题大致出现的可能性:
首先,看包的导入是否完整。一般需要导入的包有:
commons-logging-1.0.4.jar
freemarker-2.3.8.jar
ognl-2.6.11.jar
struts2-core-2.0.6.jar
xwork-2.0.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.32.jar
其次:就是看你web.xml中是否含有
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
之类的默认显示界面,其中的页面显示的jsp可以自行定义和配置相应的action用于界面的显示
第三:就是看在web.xml中是否有书写错误:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
第四:可能出现的可能性很小
就是可能是用的开发环境和平台的问题.最后是重新又写了几遍才好。
最后的解决方法,我觉得可能是与他的eclipse环境有关。因为同样的程序在我的机子上运行的很顺畅。
错误:
type Status report
message /Struts2/
description The requested resource (/Struts2/) is not available.
其中:web.xml中配置:
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>Struts 2.0 StrutsDemo</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
一开始没有进行web.xml配置时候,可以正常运行建立的jsp文件,但是添加了filter过滤器和过滤器映射后,却不能运行。经过检查,其他action文件,struts.xml文件配置均没有错误。后面着重对web。xml进行分析,觉得问题大致出现的可能性:
首先,看包的导入是否完整。一般需要导入的包有:
commons-logging-1.0.4.jar
freemarker-2.3.8.jar
ognl-2.6.11.jar
struts2-core-2.0.6.jar
xwork-2.0.1.jar
commons-fileupload-1.2.1.jar
commons-io-1.32.jar
其次:就是看你web.xml中是否含有
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
之类的默认显示界面,其中的页面显示的jsp可以自行定义和配置相应的action用于界面的显示
第三:就是看在web.xml中是否有书写错误:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
第四:可能出现的可能性很小
就是可能是用的开发环境和平台的问题.最后是重新又写了几遍才好。
最后的解决方法,我觉得可能是与他的eclipse环境有关。因为同样的程序在我的机子上运行的很顺畅。
相关文章推荐
- 配置完struts,tomcat运行错误java.lang.ClassNotFoundException: org.apache.struts.action.ActionServlet
- opencv配置好后运行出现错误:"计算机中丢失opencv_core231d.dll" 等dll文件的解决方案
- struts 配置出现错误 There is no Action mapped for namespace [/] and action name [findPage] associated with
- 使用S2SH框架时,在配置struts.xml文件使用JSON返回类型出现错误
- C程序访问hadoop出现的各种编译错误和运行时各种类DefFound异常的解决方法(makefile的书写和环境变量的配置)
- 关于以前应用程序运行出现配置错误的问题的解决方案
- struts2 配置出现错误信息This is usually caused by using Struts tags without the associated filter
- maven配置时,测试出现“'mvn' 不是内部或外部命令,也不是可运行的程序”错误
- VS2008编译的mfc程序在没有安装的机子上运行出现配置错误的问题
- Weblogic下配置Struts应用时出现tag错误的解决方法
- 关于win10 php环境配置后运行php文件出现HTTP 错误 401.3 - Unauthorized的解决方法
- DirectShow 在VS2005/VS2010中环境配置和编译运行出现 winnt.h(5940)错误问题的解决
- Notepad++一键配置python运行 & 可能出现的文件路径错误
- SSM中spring运行中出现Cannot load JDBC driver class (spring的配置错误)
- struts配置文件出现莫名错误解决方法
- 配置文件springmvc.xml或spring.xml 能运行但总是出现错误
- vs2012运行webserver时出现错误提示: 创建在“system.net/defaultProxy”配置节中指定的 Web 代理时出错。
- 在电脑上找到这个路径:D:\jakarta-tomcat-6\conf\Catalina,将localhost目录直接删除掉,再一运行,就没事了! 因为配置文件中配置了启动程序,而webapps文件夹下却没有此应用程序,所以出现了上述错误。
- [BTS]配置SOAP接收端口中出现的错误!
- struts 文件上传出现错误