This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes HTTP Status 500 - No action instance for path could be created Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "HTTP Status 500 - No action instance for path could be created" Watch "HTTP Status 500 - No action instance for path could be created" New topic
Author

HTTP Status 500 - No action instance for path could be created

krish bhadragiri
Greenhorn

Joined: Apr 17, 2007
Posts: 13
hi,
i am doing one sample application in hibernate with struts .i kept one jsp welcome file in web.xml with welcome file list.in struts-config.xml,i mapped the action path in jsp to one Action class which extends struts Action class.When i am running the tomacat server its perfectly working.and welcome file is displayed.But on submitting following error is given in browser.
"HTTP Status 500 - No action instance for path /search could be created"
Attaching the welcome file and struts-config.xml:
1.web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>


<!-- Action Servlet Mapping -->

<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<welcome-file-list>
<welcome-file>/search.jsp</welcome-file>
</welcome-file-list>


</web-app>



2.struts_config.xml:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>

<form-beans>
<form-bean name="searchForm" type="java.Search"/>
</form-beans>

<action-mappings>

<action path="/search" type="java.SearchAction" input="/failure.jsp" scope="request">

<forward name="sucess" path="/sucess.jsp"/>


</action>
</action-mappings>
</struts-config>


3.jsp file:

<html>
<head>
<title>Front page</title>
</head>
<body bgcolor="lightgreen">
<form action="search.do">
id:<input type="text" name="txt1"/>
<input name=button type=submit value="Click">
<input name=button type=reset value="reset">
</form>
</body>
</html>

4.Action class:

package java;

import common.DAOException;
import java.io.*;
import java.util.*;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.log4j.Logger;

public class SearchAction extends Action
{
private static Logger log = Logger.getLogger(SearchAction.class.getName());

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res)throws IOException,ServletException
{
HttpSession session=req.getSession();
log.info("In Search Action");
Search se=(Search)form;
try
{
String name=SearchFascade.getSearchName(se);
session.setAttribute("name",name);

}
catch(DAOException daoexception)
{
daoexception.printStackTrace();
//return mapping.findForward("failure");
}
return mapping.findForward("sucess");
}
}


please give a solution.

regards,

Murali
NareshA WaswaniA
Greenhorn

Joined: Feb 26, 2007
Posts: 9
don't use the pakage name as java. use something else.

+91-9986461501
NareshA WaswaniA
Greenhorn

Joined: Feb 26, 2007
Posts: 9
due to securith issues, the java and sun should not be used as the package names. That is the not the starting word in the package.

for ex java.xyz ----- error

xyz.java or xyz.abc.sun ------- it's ok
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
There's also another problem. You're missing some important stuff in your web.xml file. Your servlet stanza should look like this:


Merrill
Consultant, Sima Solutions
krish bhadragiri
Greenhorn

Joined: Apr 17, 2007
Posts: 13
Thanks for that.I have changed th package name and added the required tags in web.xml.But the same problem persists.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTP Status 500 - No action instance for path could be created