• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

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

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
don't use the pakage name as java. use something else.

+91-9986461501
 
NareshA WaswaniA
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's also another problem. You're missing some important stuff in your web.xml file. Your servlet stanza should look like this:
 
krish bhadragiri
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for that.I have changed th package name and added the required tags in web.xml.But the same problem persists.
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic