【问题标题】:Tomcat 7.0.32 cannot deploy my projectTomcat 7.0.32 无法部署我的项目
【发布时间】:2012-10-31 15:23:51
【问题描述】:

我不明白我应该怎么做。我也尝试过搜索 google 和 here,但没有一个解决方案能解决我的问题。

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 上传到库。

【问题讨论】:

标签: java eclipse tomcat struts


【解决方案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,因为在&lt;filter&gt; 配置中的配置中,您有一个名为:struts 的过滤器,并且您将其映射到&lt;filter-mapping&gt;,名称为@987654327 @。此过滤器未知,因为没有名为 struts2 的过滤器。像上面一样粘贴配置,一切都应该没问题。

【讨论】:

    【解决方案2】:

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

      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. 
    

    刚刚搜索了一下,找到了这个网址。看看对你有没有用

     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>
    

    【讨论】:

      【解决方案3】:

      据我所知,您的一些 jar 来自 struts1 和一些来自 struts2 ,因此请确保您已添加来自 struts1 或 struts2 的所有 jar

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-05-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-02-25
        • 2016-12-17
        • 2014-09-24
        相关资源
        最近更新 更多