Hi all,
I am expanding the Struts Upload example.
Right now I work on a step to display the data that have been uploaded to a (server-)local file.
This step consists of invoking an Action that reads the data into request scope, and a JSP to display the data.
When invoking the Action I get an error that I cannot find the cause of.
I guess that it is something elementary - like a misunderstanding of struts-config,
something missing from web.xml, or my Action class missing a crucial element.
BTW, web.xml is unchanged from the example.
Since I cannot find the spot, I am asking for a hint.
Releases used: Sun Java 1.4.2, Tomcat 4.1.30, Struts 1.2.6


Regards,
Wolfgang

Details of the Problem
================

1. Error Message I get from Tomcat:
----------------------------------

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

type Status report

message No action instance for path /anzeigen could be created

description The server encountered an internal error (No action instance for path /anzeigen could be created) that prevented it from fulfilling this request.

Apache Tomcat/4.1.30



2. Excerpt from logs/catalina.out:
---------------------------------------

23.03.2005 23:07:04 org.apache.struts.action.RequestProcessor processActionCreate
SCHWERWIEGEND: No action instance for path /anzeigen could be created
java.lang.ClassCastException
at org.apache.struts.action.RequestProcessor.processActionCreate(RequestProcessor.java:280)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:218)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1192)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:412)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)



3. struts-config ----------------

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

<struts-config>

   <form-beans>
       <form-bean name="uploadForm" type="wr.upload.UploadForm" />
   </form-beans>

   <global-forwards>
       <forward name="home" path="/index.jsp" />
       <forward name="anzeigen" path="/anzeigen.do" />
       <forward name="success2" path="/success2.jsp" />
   </global-forwards>

   <action-mappings>

       <action path="/upload"
           type="wr.upload.UploadAction"
           name="uploadForm"
           scope="request"
           input="/upload.jsp">
           <forward name="success1" path="/success1.jsp" />
       </action>

       <action path="/anzeigen"
           type="wr.upload.AnzeigenAction"
           scope="request" />

   </action-mappings>

   <controller maxFileSize="2M" />

   <message-resources parameter="resources.application" null="false" />

</struts-config>


4. AnzeigenAction.java -----------------------

package wr.upload;

import java.util.Vector;
import java.util.logging.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class AnzeigenAction
{
   private static PropertiesSingleton config;
   private static Logger logger = LoggerInitiator.getLogger();

public AnzeigenAction()
{
logger.info( "AnzeigenAction.java" );
}
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response )
throws Exception
{
config = PropertiesSingleton.getInstance();
BuchungenLesen bl = new BuchungenLesen();
Vector bchListe = bl.readFile( config.getProperty( "upload.tempfile" ));
request.setAttribute( "bchListe", bchListe );
return mapping.findForward( "success2" );
}
}



5. index.jsp (this is the caller of URI /anzeigen) ------------ <%@ page language="java" %> <%@ page import="wr.upload.*" %> <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %>

<html:html locale="true">
<head>
<title><bean:message key="index.title"/></title>
</head>
<body>
<p>
<% PropertiesSingleton ps = PropertiesSingleton.getInstance();
out.println( "Debug-Level " + ps.getProperty( "log.level" )); %>
</p>
<h2>
<bean:message key="index.title"/>
</h2>
<h3>
<table border="1">
<tr><td>
<html:link page="/upload.jsp"><bean:message key="index.upload"/></html:link>
</td></tr>
<tr><td>
<html:link forward="anzeigen"><bean:message key="index.anzeigen"/></html:link>
</td></tr>
<tr><td>
<html:link page="/laden.jsp"><bean:message key="index.laden"/></html:link>
</td></tr>
<tr><td>
<html:link page="/logview.jsp"><bean:message key="index.logfile"/></html:link>
</td></tr>
</table>
</h3>
<p>
<img border="0" align="right" alt="Logo" src="images/struts-power.gif" />
<bean:message key="general.copyright"/>
</p>
</body>
</html:html>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to