Struts2教程在.action页面上给出了404

时间:2012-08-08 21:52:55

标签: java tomcat struts2 tomcat7

我似乎遇到了与Struts2一样的问题,让它疯狂起来:@

手动编写Hello_World_Struts2_Ant项目中的文件并遇到构建路径问题,我决定下载该项目以查看并运行.....

由于某种原因,我可以从这个项目访问的唯一页面是index.jsp,当我尝试点击hello.action的链接或通过地址栏访问hello.action时,它给了我一个tomcat 404.(我正在运行tomcat 7)。

我通常会承认,这是我自己的白痴,这导致我在这里,但从struts网站下载的项目不起作用的事实只是简单烦人.....

我对tomcat错误日志不太满意,但我看不到任何可以帮助我解决此问题的内容。

非常感谢任何帮助。

为了节省我使用我拥有的所有代码加载此页面,我已经获得了在此处分发的代码:http://code.google.com/p/struts2-examples/downloads/detail?name=Hello_World_Struts_2_Ant_2_3_1_2.zip&can=2&q=

Catalina Log
=====================================
INFO: Server startup in 3099 ms

08-Aug-2012 22:28:39 org.apache.jasper.compiler.TldLocationsCache tldScanJar

INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. 

Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.

08-Aug-2012 22:28:46 org.apache.coyote.AbstractProtocol pause

INFO: Pausing ProtocolHandler ["http-bio-8080"]

08-Aug-2012 22:28:46 org.apache.coyote.AbstractProtocol pause

INFO: Pausing ProtocolHandler ["ajp-bio-8009"]

08-Aug-2012 22:28:46 org.apache.catalina.core.StandardService stopInternal

INFO: Stopping service Catalina

08-Aug-2012 22:28:46 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

SEVERE: The web application [/Hello_World_Struts2_Ant] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@39bde3d2]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@61b80d9b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

08-Aug-2012 22:28:46 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

SEVERE: The web application [/Hello_World_Struts2_Ant] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@39bde3d2]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@7a856d3b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

08-Aug-2012 22:28:46 org.apache.coyote.AbstractProtocol stop

stderr Log (INFOS Removed)
================================
08-Aug-2012 22:28:46 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

SEVERE: The web application [/Hello_World_Struts2_Ant] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@39bde3d2]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@61b80d9b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

08-Aug-2012 22:28:46 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks

SEVERE: The web application [/Hello_World_Struts2_Ant] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$10] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@39bde3d2]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@7a856d3b]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

08-Aug-2012 22:28:46 org.apache.coyote.AbstractProtocol stop

INFO: Stopping ProtocolHandler ["http-bio-8080"]

08-Aug-2012 22:28:46 org.apache.coyote.AbstractProtocol stop

INFO: Stopping ProtocolHandler ["ajp-bio-8009"]

1 个答案:

答案 0 :(得分:1)

阅读上面的帖子后,我删除了我的Tomcat安装并从头开始重新启动,似乎Tomcat一直是问题,因为它在重新安装tomcat后直接为我工作。

也许是我以root.war的身份部署了导致tomcat问题的东西。

“同样的问题”是我在发布之前已经做了一些搜索,发现很多人都有使struts启动和运行的问题,也许这是我用来描述问题的一个不好的短语。

感谢您的帮助!虽然复制到WEB-INF / lib并配置构建路径现在可以正常工作,但是很多时候人们似乎都会推荐使用Maven。