0

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

Roman C
  • 49,761
  • 33
  • 66
  • 176
Kumar Gaurav
  • 1,287
  • 3
  • 19
  • 47

1 Answers1

0

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.

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • It is in WEB-INF/classes itself – Kumar Gaurav Aug 21 '14 at 16:34
  • struts 2 more specifically struts 2.3.4 – Kumar Gaurav Aug 21 '14 at 16:47
  • If you are running on jdk lower version, you should set the java compiler compliance level to the version of jdk you run. Otherwise you'll get class version mismatch or so error. – Roman C Aug 21 '14 at 18:30
  • Will that make any change in DD or in struts.xml? If i change that using eclipse then it won't make any actual changes in files to deploy and hence doesn't seems to help me out – Kumar Gaurav Aug 21 '14 at 19:02
  • I don't understand *change in DD or in struts.xml*. I *will* make a change to resolve There is no Action mapped for namespace [/] and action name [welcome] associated with context path []. – Roman C Aug 22 '14 at 07:51