2

I dont understand what should I do. I have tried to search google and here too but none of the solutions solved my problem.

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 

the xml file

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

I'm running mac os mountain lion 64, eclipse juno and I upload all the jars from struts to a library.

4

3 回答 3

1

this line say the root cause for the issue

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

This error occurs in the following situations:

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. 

Just googled and found this url. check and see whether it is useful to you

 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>

于 2012-10-31T15:29:22.850 回答
1

Your filter configuration is wrong. This is the correct one:

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

Your filter name is struts while it should be struts2, because in your configuration in <filter> configuration you have a filter named: struts and your are mapping it in <filter-mapping> with a name struts2. This filter is unknown, because there is no filter named struts2. Paste the configuration as above and everything should be fine.

于 2012-10-31T15:32:53.267 回答
0

to the best of my knowledge some of your jars are from struts1 and some from struts2 , so please make sure you have added all jars either from struts1 or struts2

于 2012-10-31T15:32:39.627 回答