简体   繁体   中英

There is no Action mapped for namespace [/] and action name [welcome] associated with context path []

I have deployed an application on Web. Apache Tomcat version is 6.0.36

URL:www.sopmax.com

The index.html (welcome page) forwards the request to sopmax.com/welcome.

i'm getting error: There is no Action mapped for namespace [/] and action name [welcome] associated with context path []

Below is my 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/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_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>ShoppingShoe</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>


<listener>
    <listener-class>
        org.apache.struts2.tiles.StrutsTilesListener
    </listener-class>
</listener>
<context-param>
    <param-name>tilesDefinitions</param-name>
    <param-value>/WEB-INF/tiles.xml</param-value>
</context-param>
<welcome-file-list>
    <welcome-file>
        index.html
    </welcome-file>
  </welcome-file-list>
</web-app>

struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
   "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
   "http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
    <constant name="struts.devMode" value="true" />
    <constant name="struts.custom.i18n.resources" value="global" />
    <package name="default" extends="struts-default" namespace="/">
    <result-types>
        <result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
    </result-types>  
    <interceptors>
        <interceptor name="secure" class="com.mss.interceptor.SecureStack">
        </interceptor>
        <interceptor-stack name="securestack">
            <interceptor-ref name="secure"></interceptor-ref>
            <interceptor-ref name="defaultStack"></interceptor-ref>
        </interceptor-stack>
    </interceptors>      
    <default-interceptor-ref name="securestack"></default-interceptor-ref>
        <action name="welcome*" class="com.mss.actions.Welcome" method="showHome">
            <result type="tiles" name="success">welcome</result>
        </action> 
 </package>    

</struts>

I have showHome method in com.mss.actions.Welcome class and that works perfectly. The same application is running flawless on local server but not on web.

I've also set struts.devmode=true but error i'm getting seems generated by tomcat and not struts. please tell me what i'm missing.

Server:tomcat-apache 6.0.36 Java: I have developed on 1.7 and most probably on web they have 1.6

Struts configuration file should be on classpath, so it's usually placed in the src or resources both are used as a source folders. After deployment it should be in the WEB-INF/classes . But your struts.xml location is different, and configuration isn't parsed and not available at runtime.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM