Question

I have been developing my first simple application. I have included all the necessary libraries into the WEB_CONTENT/WEB_INF/lib in order to run a basic struts application. But when i open the url it shows:
The requested resource (/StrutsStarter/getStarter.action) is not available.

I have no idea why it is not working properly because since the dubug gives no error. Any help would be appreciated.

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_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>StrutsStarter</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>success.jsp</welcome-file>
</welcome-file-list>

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


</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>
<package name="default" extends="struts-default">
    <action name="getStarter" class="org.aars.action.StarterAction">
        <result name="success">/success.jsp</result>

    </action>

</package>

</struts>

StarterAction

package org.aars.action;

public class StarterAction {

    public String execute(){
        System.out.println("StarterAction Executed");
        return "success";
    }

}

I added these jars

  • commons-fileupload-1.2.2.jar
  • commons-io-2.0.1.jar
  • commons-lang-2.4.jar
  • commons-logging-1.1.1.jar
  • commons-logging-api-1.1.jar
  • freemarker-2.3.19.jar
  • javassist-3.11.0.GA.jar
  • ognl-3.0.6.jar
  • struts2-core-2.3.14.3.jar
  • xwork-core-2.3.14.3.jar

Thanks in advance.

Was it helpful?

Solution

Finally i found the answer.

I just added one more jar commons-lang3-3.1.jar to build path makes it work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top