The Struts dispatcher cannot be found while deploy - java

When I try to run my Spring + Struts 2 project on WL Server 9.2 (I have to user this version, so please don't ask me to user the newer version of WL Server), I had this error.
The URL address in the browser is :
http://localhost:7003/SpringStrust2/
Full stacktrace:
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at jsp_servlet.__user._jsp__tag0(__user.java:115)
at jsp_servlet.__user._jspService(User.jsp:12)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:175)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3269)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2019)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1925)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1394)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:181)
Here is my web.xml:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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>
<welcome-file-list>
<welcome-file>User.jsp</welcome-file>
</welcome-file-list>
struts.xml:
<struts>
<constant name="struts.enble.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.custom.i18n.resources" value="myapp" />
<package name="default" extends="struts-default">
<action name="user" class="user">
<result name="success">/success.jsp</result>
<result name="input">/User.jsp</result>
</action>
</package>
</struts>
user.jsp:
<%# taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Spring + Struts2</title>
</head>
<body>
<s:form action="user" method="addUser">
<s:textfield name="username" key="user.name" />
<s:submit key="submit" />
</s:form>
</body>
</html>
I'm very sure about putting files in correct folders, including jar libraries in lib folder...
Here is the list of jars I'm using:
antlr-runtime-3.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-lang3-3.1.jar
commons-logging-1.1.jar
freemarker-2.3.13.jar
junit-3.8.1.jar
ornl-2.6.11.jar
org.springframework.asm-3.9.9.M3.jar
org.springframework.beans-3.0.0.M3.jar
org.springframework.context-3.0.0.M3.jar
org.springframework.core-3.0.0.M3.jar
org.springframework.web-3.0.0.M3.jar
org.springframework.web.servlet-3.0.0.M3.jar
struts2-convention-plugin-2.1.6.jar
struts2-core-2.1.6.jar
struts2-spring-plugin-2.1.6.jar
xwork-2.1.2.jar

You're hitting the User.jsp file (with its S2 tags) without running through an action like the error says.
You can either:
Redirect to a Struts action from the welcome file (a common technique, and trivial)
configure the container to allow actions as welcome files
Remove the S2 tags from the welcome file

I had the same problem. My Struts 2 application was running on localhost like knife on butter but on VPS it failed. Finally the solution is that Web-Inf folder in project conflicts with web-inf folder of Tomcat.
So move your project/web-inf/web.xml contents to
usr/local/easy/share/easy-tomcat7/conf (for Cent OS)
and move your jars from youtproject/web-inf/lib to
usr/local/easy/share/easy-tomcat7/lib (for Cent OS)
For other OS do the same at respective path..
Hope this will be helpful..

Related

Struts2 isn't loading my webapp...404 error?

I am a complete newbie to Struts2 and am unable to run anything involving it on tomcat in either eclipse/browser. Tomcat is working fine when I am just mapping servlets/jsp in a web.xml file, but when trying to switch to struts2 I can't get it to work. When I try to run on the server it isn't even going to my index jsp...just loading a 404 error. I followed an online tutorial when I couldn't get my app for my class running and the tutorial I can't get to run either. Here are the jar files I have added to tomcat lib/build path jars -
asm-5.0.2.jar
asm-commons-5.0.2.jar
asm-tree-5.0.2.jar
commons-fileupload-1.3.1.jar
commons-io-2.2.jar
commons-lang3-3.2.jar
commons-logging-1.1.3.jar
commons-logging-api-1.1.jar
freemarker-2.3.19.jar
javassist-3.11.0.GA.jar
ognl-3.0.6.jar
struts-core-1.3.10.jar
struts2-dojo-plugin-2.3.20.jar
xwork-core-2.3.20.jar
filter added to web.xml -
<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 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" />
<package name="helloworld" extends="struts-default">
<action name="hello"
class="com.struts2.files.HelloWorldAction"
method="execute">
<result name="success">/HelloWorld.jsp</result>
</action>
</package>
</struts>
Any ideas as to why I am getting a 404 when trying to run the app?
I guess, you've added the wrong struts-core-1.3.10.jar to your classpath. That probably belongs to Struts 1.x. You need to include the latest struts2-core-2.x.x.jar from the Struts 2 framework.
A typical Struts 2 application has the following jars under WEB-INF/lib directory.
commons-fileupload-1.2.1
commons-io-1.3.2
commons-logging-1.1
freemarker-2.3.13
junit-3.8.1
ognl-2.6.11
xwork-2.1.2
struts2-core-2.1.6
struts2-convention-plugin-2.1.6 (if using annotations)
Try downloading the latests jars from struts.apache.org.
The filter class org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter belongs to Struts2 but you are using struts1 jar file struts-core-1.3.10.jar
As Ravi suggested, download the Jar file from Struts-2.3.20

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [login] associated with context path [/struts2]

I have learned theory of Struts2 and now practicing. Facing problems while executing project.I searched in Google in many ways but could not find result.Please help me. Below is the code.Please help me friends...
Project structure:
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>struts2</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>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="resources" value="ApplicationResources" />
<constant name="struts.devMode" value="true" />
<package name="default" extends="struts-default">
<action name="login" class="com.practice.structs.actions.LoginAction"
method="validateUser">
<result name="success">pages/homepage.jsp</result>
<result name="error">pages/login.jsp</result>
</action>
</package>
LoginAction.java
package com.practice.structs.actions;
import com.opensymphony.xwork2.ActionSupport;
public class LoginAction extends ActionSupport {
private String userName;
private String password;
public String validateUser(){
if(this.userName.equalsIgnoreCase("abc") && this.password.equalsIgnoreCase("abc"))
{
return "success";
}else{
addActionError(getText("error.login"));
return "error";
}
}
/**
* #return the userName
*/
public String getUserName() {
return userName;
}
/**
* #param userName the userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}
/**
* #return the password
*/
public String getPassword() {
return password;
}
/**
* #param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
}
login.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%# taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Login page</title>
</head>
<body>
<H1><I>Login Page</I></H1>
<s:actionerror />
<s:form action="login.action" method="post">
<s:textfield name="uname" key="label.username" size="20"/>
<s:password name="password" key="label.password" size="20"/>
<s:submit method="execute" key="label.login" align="center"/>
</s:form>
</body>
</html>
homepage.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%#taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<H2><I>Welcome</I></H2>
</body>
</html>
change your code like this
<package name="default" namespace="/" extends="struts-default">
<action name="login" class="com.practice.structs.actions.LoginAction"
method="validateUser">
<result name="success">pages/homepage.jsp</result>
<result name="error">pages/![enter image description here][1]login.jsp</result>
</action>
</package>
<s:form action="login" method="post">
<s:textfield name="uname" key="label.username" size="20"/>
<s:password name="password" key="label.password" size="20"/>
<s:submit method="execute" key="label.login" align="center"/>
</s:form>
your action name in form is action.login and in struts.xml is login both should be same and also add the namespace
I know this question is a bit outdated, but I also thought it's worth mentioning, to those who happen to end up stumbling onto this post again and still experiencing the issue; assuming you're 100% sure that your mappings are correct and that your web.xml contains the appropriate filter, try the following:
Stop your Tomcat server
Create a "classes" folder in your "WEB-INF" folder
Move your struts.xml file into the newly created "classes" folder
Right click on your Tomcat Server and select "Clean" - not required, but would recommend doing so.
Start up Tomcat again and hope for the best :-)
As a visual aid, your WEB-INF should end up looking something like this:
If you're still experiencing the issue, double check your struts mappings again, as well as your web.xml
I don't have enough points to respond Ryan's comment nor rate him, but what he says is a valid solution in concrete cases, and I am going to tell why.
Sometimes the folders you create in a project are not taken as resources of the application, and you have to configure it.
Let me explain myself with a practical example that may have occurred to some mates who asked for this problem:
When you are developing with Eclipse, maybe you choose another project explorer than the Eclipse's default "Project Explorer", as the "Navigator", for example.
Using "Navigator" view, you can create folders, but this folders are not package resources (as they are when you create "package resources" with the default "Project Explorer"), so Struts2 cannot find "struts.xml" file to configure the actions.
So, the only folders that your project will process as "package resources" are the ones under WEB-INF as Eclipse do in "Dynamic Web Projects" by default.
So then, be sure of having all the configuration files in a "package resource".
In your LoginAction.java properties you took are
private String userName;
private String password;
But in you login.jsp you wrote as
<s:textfield name="uname" key="label.username" size="20"/>
<s:password name="password" key="label.password" size="20"/>
Change
<s:textfield name="uname" key="label.username" size="20"/> to
<s:textfield name="userName" key="label.username" size="20"/>
I hope this answer solves your problem ...
make the changes on struts.xml file,, add namespace="/" attribute in
like
<package name="default" namespace="/" extends="struts-default">
To solve this problem I had to create a classes folder in WEB-INF and place the struts.xml file there. Then I placed the .jsp files in the web folder and placed '/' before the .jsp files, for example /x.jsp

http status 404 The requested resource (/Crime/) is not available [duplicate]

This question already has answers here:
HTTP Status 404 - The requested resource (/ProjectName/) is not available
(3 answers)
Closed 6 years ago.
I'm using struts framework and this problem is occurred when i deploy my project....
why this error is occurred at the deploy time???
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>userLogin.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>f1</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>f1</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
</web-app>
tiles.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="common" template="/FirstLayout.jsp">
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="body" value="/footer.jsp"/>
</definition>
<definition name="validUser" extends="common">
<put-attribute name="title" value="Login User"/>
<put-attribute name="contents" value="/userLogin.jsp"/>
</definition>
<definition name="invalidUser" extends="common">
<put-attribute name="tilte" value="Login Error" />
<put-attribute name="contents" value="/relogin.jsp" />
</definition>
</tiles-definitions>
struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN" "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
<package name="p1" extends="tiles-default">
<action name="signin" class="action.LoginAction ">
<result name="success" type="tiles">validUser</result>
<result name="failure" type="tiles">invalidUser</result>
</action>
</package>
</struts>
this error is occurring while i add struts jar file in my project... earlier it was running without any error..Is there any problem with my strut file. I am using Myeclipse 8.5 and Tomcat server 6.0.
.
The thread is old, but I will post the solution anyway, as more people are learning how to write a web application using apache struts frame work, they will undoubtedly encounter the same problem.
The problem is that Eclipse does not copy the ROOT folder from Apache Tomcat to your Eclipse work place.
Just go to your Apache-Tomcat folder, then COPY the ROOT folder in the webapps folder.
Paste it into your Eclipse:
your_workspace.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
tmp0 is your current server.
Also, just make sure you add your struts .jar files.
That's all folks
TL
404 may occur due to either not setting welcome file(but you set it) or if the server failed to deploy your project.
The second may be the reason here.
Check the console logs did the server start at all.
Secondly as you mention about the jar it may happen that you have included two jars of struts but with different versions.
Better use a build tool like Maven or Ant.
Tell if that helps.Thanks.

There is no Action mapped for namespace / and action name tutorial

I am unable to execute my struts2 application. I am using eclipse indigo IDE, tomcat 7 and jdk 1.7.
The jar files I included are:
commons-logging-1.0.4.jar,
freemarker-2.3.8.jar,
ognl- 2.6.11.jar,
struts2-core-2.0.11.jar,
xwork-2.0.4.jar
I placed the struts.xml in classes folder in WEB-INF and I also tried it placing in
src folder but I could not able to make it. I am getting the below error on console
There is no Action mapped for namespace / and action name tutorial. - [unknown location]
index.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="./tutorial.action">
Username: <input type="text" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
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>
<package name="default" extends="struts-default">
<action name="tutorial" class="com.test.TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/failure.jsp</result>
</action>
</package>
</struts>
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>Struts2Starter</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
TutorialAction.java
package com.test;
public class TutorialAction {
public String execute() {
System.out.println("Hello from execute");
return "success";
}
}
As others have pointed out, you do not have a getTutorial action in your mapping, only a "tutorial". However, I'm going to skip over that and suggest that you learn how to sanity check a Struts2 app. Anytime you are setting up a new technology, and even when you are working with a familiar technology, it is very useful to understand how to do a basic sanity check -- in this case, you need to verify that your struts xml has been successfully parsed and the framework knows about your actions.
I HIGHLY RECOMMEND you add the Struts 2 Config Browser plugin to your struts 2 apps. To add the plugin, you just get the jar ( all struts 2 plugins are jars ) and put in your webapp's lib directory. That's it. When you start your applicaiton, hit this URL:
http://localhost:8080/starter/config-browser/index.action
And it shows you all of the actions, as well as other configurations, that the framework knows about. Essentialy struts 2 diagnostic tool, and too easy to use to not use it.
Try to add namespace attribute into you package element of struts.xml file.
Like this:
<struts>
<package name="default" extends="struts-default" namespace="/">
<action name="tutorial" class="com.test.TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/failure.jsp</result>
</action>
</package>
</struts>
I had the same problem and I saw multiple posts on this one....here is the possible solution
I was pretty sure that I had mapped all my actions accurately, but it was showing the same error above....so I just cleaned the project and then ran it again..it worked perfectly fine...give it a try !
I encountered this so many times...so to avoid such kind of things, I just added "../eclipse.exe -clean" to the shortcut icon property....this works and u can forget about getting such kind of errors which is actually not an error....!
The error comes because the server is not able to find correct path for struts.xml .
Its better to put the struts.xml in parallel to src folder or in WEB-INF/classes.
Try this once don't append .action
<form action="tutorial">
place your struts.xml file in src outside the package or in WEB-INF classes folder.

How do I figure out why my Struts 2 action hasn't been mapped? [duplicate]

I am unable to execute my struts2 application. I am using eclipse indigo IDE, tomcat 7 and jdk 1.7.
The jar files I included are:
commons-logging-1.0.4.jar,
freemarker-2.3.8.jar,
ognl- 2.6.11.jar,
struts2-core-2.0.11.jar,
xwork-2.0.4.jar
I placed the struts.xml in classes folder in WEB-INF and I also tried it placing in
src folder but I could not able to make it. I am getting the below error on console
There is no Action mapped for namespace / and action name tutorial. - [unknown location]
index.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="./tutorial.action">
Username: <input type="text" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
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>
<package name="default" extends="struts-default">
<action name="tutorial" class="com.test.TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/failure.jsp</result>
</action>
</package>
</struts>
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>Struts2Starter</display-name>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
TutorialAction.java
package com.test;
public class TutorialAction {
public String execute() {
System.out.println("Hello from execute");
return "success";
}
}
As others have pointed out, you do not have a getTutorial action in your mapping, only a "tutorial". However, I'm going to skip over that and suggest that you learn how to sanity check a Struts2 app. Anytime you are setting up a new technology, and even when you are working with a familiar technology, it is very useful to understand how to do a basic sanity check -- in this case, you need to verify that your struts xml has been successfully parsed and the framework knows about your actions.
I HIGHLY RECOMMEND you add the Struts 2 Config Browser plugin to your struts 2 apps. To add the plugin, you just get the jar ( all struts 2 plugins are jars ) and put in your webapp's lib directory. That's it. When you start your applicaiton, hit this URL:
http://localhost:8080/starter/config-browser/index.action
And it shows you all of the actions, as well as other configurations, that the framework knows about. Essentialy struts 2 diagnostic tool, and too easy to use to not use it.
Try to add namespace attribute into you package element of struts.xml file.
Like this:
<struts>
<package name="default" extends="struts-default" namespace="/">
<action name="tutorial" class="com.test.TutorialAction">
<result name="success">/success.jsp</result>
<result name="failure">/failure.jsp</result>
</action>
</package>
</struts>
I had the same problem and I saw multiple posts on this one....here is the possible solution
I was pretty sure that I had mapped all my actions accurately, but it was showing the same error above....so I just cleaned the project and then ran it again..it worked perfectly fine...give it a try !
I encountered this so many times...so to avoid such kind of things, I just added "../eclipse.exe -clean" to the shortcut icon property....this works and u can forget about getting such kind of errors which is actually not an error....!
The error comes because the server is not able to find correct path for struts.xml .
Its better to put the struts.xml in parallel to src folder or in WEB-INF/classes.
Try this once don't append .action
<form action="tutorial">
place your struts.xml file in src outside the package or in WEB-INF classes folder.

Categories