无法让Tomcat在我的Struts 2应用程序上启动服务器

时间:2013-03-22 19:30:06

标签: java tomcat struts2

我正在尝试运行 Very 基本的Struts 2应用程序但是每当我尝试运行服务器时,我的日志中都会出现以下错误:

Mar 22, 2013 12:09:44 PM 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: C:\Program Files (x86)\Java\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Users\DJ\Downloads\eclipse-jee-juno-SR2-win32\eclipse;
Mar 22, 2013 12:09:44 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DDay' did not find a matching property.
Mar 22, 2013 12:09:44 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 22, 2013 12:09:44 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 22, 2013 12:09:45 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 939 ms
Mar 22, 2013 12:09:45 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 22, 2013 12:09:45 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.37
Mar 22, 2013 12:09:45 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
  java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
  at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
  at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
  at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
  at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
  at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
  at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4656)
  at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5309)
  at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
  at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
  at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
Mar 22, 2013 12:09:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Mar 22, 2013 12:09:45 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/DDay] startup failed due to previous errors
Mar 22, 2013 12:09:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 22, 2013 12:09:45 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 22, 2013 12:09:45 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 601 ms

我已经获得了struts 2应用程序所需的所有.jars

公地文件上传-1.2.2.jar

公地-IO-2.0.1.jar

共享记录-1.1.1.jar

共享记录-api.1.1.jar

的freemarker-2.3.19.jar

OGNL-3.0.6.jar

struts2的核 - 2.3.12.jar

XWork的核 - 2.3.12.jar

了Javassist-3.11.0.GA.jar

这是我的web.xml文件。

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:javaee="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" id="WebApp_9" version="2.4">
<display-name>Struts2 Application</display-name>
<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>
</web-app>

我在同一个错误中看过几个帖子,但似乎没有一个解决方案可行。如果它不是罐子而不是web.xml文件,它可能是什么?

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我不知道Struts2但...... ......看这个网站:http://www.jarvana.com/jarvana/search?search_type=class&java_class=org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter 似乎对于那个版本的struts2,该类不在struts2-core.jar

尝试使用另一版本的struts2。