Tomcat 7.0.32无法部署我的项目

时间:2012-10-31 15:23:51

标签: java eclipse tomcat struts

我不明白我该怎么办。我试图搜索谷歌和这里,但没有一个解决方案解决了我的问题。

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/strus2starter]]
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:252)
    at java.util.concurrent.FutureTask.get(FutureTask.java:111)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    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(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/strus2starter]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    ... 7 more
Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts2
    at 

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/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
    id="WebApp_ID" version="3.0">
    <display-name>strubs2Starter</display-name>
    <welcome-file-list>
        <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>
    </welcome-file-list>



<filter>
    <filter-name>struts</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>

我正在运行mac os mountain lion 64,eclipse juno,我将所有的jar从struts上传到一个库。

3 个答案:

答案 0 :(得分:1)

这一行说明问题的根本原因

  Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts2

在以下情况下会发生此错误:

your web.xml file has a <filter-mapping> with no matching <filter>. Each mapping must include a <filter-name> that matches a <filter-name> in a <filter> element.
your web.xml file has a correctly matched filter-mapping and filter element, but the filter-mapping appears before the filter. The filter-mapping must appear below the filter, because the file is parsed in order. 

直接用Google搜索并找到此网址。检查并查看它是否对您有用

 http://wiki.metawerx.net/wiki/Java.lang.IllegalArgumentException


As per you web xml following is the correct one

<filter>
   <filter-name>struts2</filter-name>
      <filter-  class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

答案 1 :(得分:1)

您的过滤器配置错误。这是正确的:

<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>

您的过滤器名称为struts,但它应为struts2,因为在<filter>配置的配置中,您有一个名为struts的过滤器,并且您将其映射到名为<filter-mapping>的{​​{1}}。此过滤器未知,因为没有名为struts2的过滤器。粘贴上面的配置,一切都应该没问题。

答案 2 :(得分:0)

据我所知,你的一些罐子来自struts1,一些来自struts2,所以请确保你已经添加了来自struts1或struts2的所有罐子