1

我似乎遇到了每个人在使用 Struts2 时遇到的同样问题,并且启动并运行它,让我发疯:@

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

出于某种原因,我可以从这个项目访问的唯一页面是 index.jsp,当我尝试单击 hello.action 的链接或通过地址栏访问 hello.action 时,它给了我一个 tomcat 404。(我正在运行雄猫 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"]
4

1 回答 1

1

在阅读了上述帖子后,我删除了我的 Tomcat 安装并以这种方式重新开始,似乎 Tomcat 是问题所在,因为它在重新安装 Tomcat 后立即为我工作。

可能是我将东西部署为 root.war 导致了 tomcat 问题。

“同样的问题”是我在发布这篇文章之前做了一些搜索,发现很多人在启动和运行 struts 时遇到了问题,这可能是我描述这个问题的一个糟糕的短语。

不过感谢您的帮助!肯定会像很多人推荐的那样研究 Maven,尽管现在复制到 WEB-INF/lib 和配置构建路径有效:)

于 2012-08-29T13:05:52.620 回答