启动tomcat时的日志
Apr 28, 2011 10:52:57 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\software\jdk1.5.0_06\bin;.;C:\WINDOWS\system32;C:\WINDOWS;D:/software/jdk1.5.0_06/bin/../jre/bin/client;D:/software/jdk1.5.0_06/bin/../jre/bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\TortoiseSVN\bin.;D:\software\jdk1.5.0_06\bin;D:\software\Ant 1.7\bin;D:\software\Axis2-1.5.4\axis2-1.5.4-bin\axis2-1.5.4\bin;C:\Program Files\IDM Computer Solutions\UltraEdit\
Apr 28, 2011 10:52:58 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsHelloWorld' did not find a matching property.
Apr 28, 2011 10:52:58 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:StrutsHelloWorld1' did not find a matching property.
Apr 28, 2011 10:53:00 AM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 28, 2011 10:53:00 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 3657 ms
Apr 28, 2011 10:53:00 AM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 28, 2011 10:53:00 AM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
Apr 28, 2011 10:53:01 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Apr 28, 2011 10:53:01 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Apr 28, 2011 10:53:01 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/StrutsHelloWorld1] startup failed due to previous errors
log4j:WARN No appenders could be found for logger (com.opensymphony.xwork2.config.providers.XmlConfigurationProvider).
log4j:WARN Please initialize the log4j system properly.
Apr 28, 2011 10:53:05 AM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 28, 2011 10:53:05 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 28, 2011 10:53:05 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/46 config=null
Apr 28, 2011 10:53:05 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4951 ms
答案 0 :(得分:19)
如果你有......
然后你得到&#34; java.lang.ClassNotFoundException:org.apache.struts2.dispatcher.FilterDispatcher&#34;错误,那么你可能会在错误的情况下做。
<强>溶液强>
检查您的struts2-core-x.x.jar版本。
- &gt;如果是struts2-core- 2.5 .jar,请将web.xml中的过滤器类标记值更改为
<filter-class>
org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter
</filter-class>
- &gt;如果是struts2-core- 2.1.3 .jar,请将web.xml中的过滤器类标记值更改为
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
自Struts 2.1.3起,不推荐使用FilterDispatcher。如果您使用的是旧版本,请使用上述解决方案。
- &gt;如果是struts2-core- 2.3.X .jar,请将web.xml中的过滤器类标记值更改为
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
所有这些背后的原因是struts 2控制器被放置在不同版本的struts2-core jar中的不同位置,有时它们被不同的名称调用,如 2.1.3 中所示。< / p>
谢谢,
答案 1 :(得分:1)
Struts2在执行程序之前需要一定数量的jar文件。确保您的编辑工具中包含以下内容:
commons-logging-x.x.jar
freemarker-x.x.jar
xwork-x.x.jar
struts2-core-x.x.jar
ognl-x.x.jar
普通伐木罐可能会丢失。
查看struts2 lib文件以获取这些jar文件。 :)
你也可以查看这个网址:
答案 2 :(得分:1)
如果您正在使用Eclipse,那么仅在Java Build Path中添加所需的库将不起作用。您必须在Deployment Assembly中再次添加这些库。 右键单击项目&gt;&gt;属性&gt;&gt;选择部署Assemlby。 单击Add ..按钮添加所需的Java Build Path条目。
答案 3 :(得分:0)
检查您的Web应用程序的类路径中是否有struts2.jar
。
答案 4 :(得分:0)
问题仅在于您的类路径设置,因为您的类路径中包含所有jar。 如果你正在使用eclipse,只需从类路径中删除所有jar,然后再从头开始构建类路径。 它会起作用
答案 5 :(得分:0)
第一步看下面的tomcat webapp lib文件夹下面的jar包没有副本,
答案 6 :(得分:0)
这对我有用:
答案 7 :(得分:-2)
Struts2使用了很多依赖的jar,将它们放在WEB-INF / lib文件夹中。这种组合对我有用。我将它们部署在Tomcat-7.0.6或7.0.57
上我用过的兼容罐子: Struts2的核心 - 2.3.4.jar 公地文件上传-1.3.1.jar 公地IO-2.4.jar 共享记录-1.1.3.jar 共享记录-API-1.1.jar freemarker的-2.3.23.jar OGNL-3.1.4.jar XWork的核心 - 2.3.4.jar javaassist-3.2.0-GA.jar 公地lang3-3.4.jar