Problemas com struts

Pessoal,

Estou iniciando com o desenvolvimento através de struts, e me deparei com um erro cuja solução não estou encontrando.

o Erro é o seguinte:

HTTP status 500 - No action instance for path /buscarCadastroFuncionario could be created

meu struts-config.xml

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

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


<struts-config>
    <form-beans>
        <form-bean name="CadastrarFuncionarioForm" type="strutsdemo.form.CadastrarFuncionarioForm"/>
        <form-bean name="InformarNomeFuncionarioForm" type="strutsdemo.form.InformarNomeFuncionarioForm"/>
    </form-beans>
    
    <global-exceptions>
    
    </global-exceptions>

    <global-forwards>
    </global-forwards>

    <action-mappings>
        <action
            path="/cadastrarFuncionario"
            type="strutsdemo.action.CadastrarFuncionarioAction" 
            name="CadastrarFuncionarioForm" 
            scope="request" 
            validate="true" 
            input="/cadastrarFuncionario.jsp">
            <forward name="success" path="/index.jsp"/>
            <forward name="failure" path="/error.jsp"/>
        </action>
        <action
            path="/buscarCadastroFuncionario" 
            type="strutsdemo.action.BuscarCadastroFuncionarioAction" 
            name="InformarNomeFuncionarioForm" 
            scope="request" 
            validate="true" 
            input="/informarNomeFuncionario.jsp"> 
            <forward name="success" path="/index.jsp"/>
            <forward name="failure" path="/error.jsp"/>
        </action>
    </action-mappings>
    
    <controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

    <message-resources parameter="com/myapp/struts/ApplicationResource"/>    
    
    <!-- ========================= Tiles plugin ===============================-->
    <!--
    This plugin initialize Tiles definition factory. This later can takes some
    parameters explained here after. The plugin first read parameters from
    web.xml, thenoverload them with parameters defined here. All parameters
    are optional.
    The plugin should be declared in each struts-config file.
    - definitions-config: (optional)
    Specify configuration file names. There can be several comma
    separated file names (default: ?? )
    - moduleAware: (optional - struts1.1)
    Specify if the Tiles definition factory is module aware. If true
    (default), there will be one factory for each Struts module.
    If false, there will be one common factory for all module. In this
    later case, it is still needed to declare one plugin per module.
    The factory will be initialized with parameters found in the first
    initialized plugin (generally the one associated with the default
    module).
    true : One factory per module. (default)
    false : one single shared factory for all modules
    - definitions-parser-validate: (optional)
    Specify if xml parser should validate the Tiles configuration file.
    true : validate. DTD should be specified in file header (default)
    false : no validation

    Paths found in Tiles definitions are relative to the main context.
    -->
    <plug-in className="org.apache.struts.tiles.TilesPlugin" >
        <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />      
        <set-property property="moduleAware" value="true" />
    </plug-in>
    
    <!-- ========================= Validator plugin ================================= -->
    <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
        property="pathnames"
        value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
    </plug-in>
  
</struts-config>

meu action:

package strutsdemo.action;
import java.sql.SQLException;
import java.util.LinkedList;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import strutsdemo.bean.Funcionario;
import strutsdemo.dao.GerenciaFuncionario;

public class BuscarCadastroFuncionarioAction extends Action
{
   public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {
        ActionErrors errors = new ActionErrors();
        LinkedList listaFuncionarios;
        String nome;
        try
        {
            nome = request.getParameter("nomeFuncionario");
            HttpSession sessao = request.getSession();
            listaFuncionarios = new LinkedList();
            GerenciaFuncionario gerenteFuncionario = new GerenciaFuncionario();
            listaFuncionarios = gerenteFuncionario.buscarFuncionario(nome);
            sessao.removeAttribute("listaCadastroFuncionarios");
            sessao.setAttribute("listaCadastroFuncionarios",listaFuncionarios);
        }
        catch(SQLException sqlex)
        {
            errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.cadastroFuncionario.insert"));
            System.out.println(sqlex.getMessage());
            getServlet().log("Buscando Funcionario", sqlex);
        }
        if(!errors.isEmpty())
        {
            saveErrors(request, errors);
            return (mapping.findForward("failure"));
        }
        else
        {
            return(mapping.findForward("success"));
        }
    }    
}
package strutsdemo.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

public class InformarNomeFuncionarioForm extends ActionForm
{
    private String nomeFuncionario;
    public void reset(ActionMapping mapping, HttpServletRequest request) 
    {
        nomeFuncionario = "";
    }
    
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) 
    {

        ActionErrors errors = new ActionErrors();
        //Valida Formato do idUsuario

        if ((nomeFuncionario == null) || (nomeFuncionario.length() < 1)) 
        {
            errors.add("nome", new ActionError("error.cadastroFuncionario.nome.requerido"));
        }
        return errors;
    }
    
    public String getNomeFuncionario()
    {
        return nomeFuncionario;
    }
    
    public void setNomeFuncionario(String nomeFuncionario)
    {
        this.nomeFuncionario = nomeFuncionario;
    }
}

meu jsp:

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<html:html locale="true">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
        <meta name="ProgId" content="FrontPage.Editor.Document">
        <title><bean:message key="principal.title"/></title> 
        <style type="text/css"> 
		table#alter td {background:#ADA2E0;}
		table#alter tr.dif td {background:#EEEEEE;}
		table#alter tr.dif2 td {background:#C9D3E3;}
	</style>
        <style>
            body {font-family:verdana; font-size: 12px; color:black}
            td {font-family:verdana; font-size:11px}
            .button { font-family:verdana; font-size:12px; font-weight:bold; color:white}
            H3
            {font-family:verdana; font-size: 18px;
                MARGIN-TOP: 3px;
                MARGIN-BOTTOM: 3px

            }
            H4
            {font-family:verdana; font-size: 16px;
                MARGIN-TOP: 3px;
                MARGIN-BOTTOM: 3px

            }
            H5
            {font-family:verdana; font-size: 14px;
                MARGIN-TOP: 3px;
                MARGIN-BOTTOM: 3px
            }
            ul { MARGIN-TOP: 3px; MARGIN-BOTTOM: 3px }
            A
            {
                    color: black;
                TEXT-DECORATION: underline
            }
            A:hover
            {
                    color: #9999cc;
                    TEXT-DECORATION:none
            }
        </style>
    </head>

    <body bgcolor="White">

        <table align=center width="700" cellspacing="0" cellpadding="0" border="0">
            <tr><td><img border="0" src="imagens/top.jpg" width="700" height="17"></td></tr>
        </table>

        <table align=center width="700" cellspacing="0" cellpadding="0" border="0">
            <tr>
                <td width="183" height="27"><img border="0" src="imagens/menu-left.jpg" width="183" height="27"></td>
                <td bgcolor="black" wdith="517" class="button" align=right><a href="index.html" style="color:white"></a>
                    <html:link page="/funcionarios.jsp" style="color:white"><bean:message key="menu.funcionarios"/></html:link> | 
                    <html:link page="/pacientes.jsp" style="color:white"><bean:message key="menu.pacientes"/></html:link> | 
                    <html:link page="/radiografias.jsp" style="color:white"><bean:message key="menu.radiografias"/></html:link> | 
                    <html:link page="/funcionarios.jsp" style="color:white"><bean:message key="menu.logout"/></html:link>
                </td>
            </tr>
            <tr>
                <td width="183" height="27"><img border="0" src="imagens/title-left.jpg" width="183" height="71"></td>
                <td wdith="517" background="imagens/menu-bk.gif" align=center><span style="font-size:28px;color:white;font-family:Arial"><i><b><bean:message key="principal.title2"/></b></i></span></td>
            </tr>
            <tr>
                <td width="183" height="8"><img border="0" src="imagens/space-left.jpg" width="183" height="8"></td>
                <td wdith="517"><img src="imagens/x.gif" width="517" height="8"></td>
            </tr>
        </table>

        <table align=center width="700" cellspacing="0" cellpadding="1" border="0" height="400">
            <tr>
                <td bgcolor="#9999cc">
                    <table align=center width="100%" cellspacing="0" cellpadding="0" border="0" height="100%">
                        <tr>
                            <td bgcolor="#F8F8F1" valign="top">
                                <table cellspacing=20 border=0 align=center width=100%>
                                    <tr>
                                        <td width=100% valign=top>
                                            <!-- TEXTO AQUI-->
                                            <br<br><br><br><br>
                                            <center><font size="4" color="black"><bean:message key="informar.nome"/></font><center>
                                            <br><br>
                                            <html:form action="/buscarCadastroFuncionario.do" method="post">
                                               <table align="center" width="80%" border="0" id="alter">
                                                    <tr align="center">
                                                        <td width="50%" height="24"><font color="#000000"><center><bean:message key="label.nome"/></center></font></td>
                                                    </tr>
                                                    <tr class="dif2">
                                                        <td><center><html:text property="nomeFuncionario" size="40"/></center></font></td>
                                                    </tr>
                                               </table>
                                               <table>
                                                   <tr>
                                                        <td colspan="2" align="center">
                                                            <html:submit><bean:message key="botao.enviar"/></html:submit> 
                                                            <html:reset><bean:message  key="botao.reset"/></html:reset>
                                                        <td>
                                                   <tr>
                                               </table>    
                                           </html:form>
                                        </td>  
                                    </tr>
                                </table>       
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
        <table align=center width="700" cellspacing="0" cellpadding="0" border="0" height="8">
            <tr>
                <td>
                    <img border="0" src="x.gif" width="700" height="8">
                </td>
            </tr>
        </table>
        <table align=center width="700" cellspacing="0" cellpadding="1" border="0" height="60">
            <tr>
                <td bgcolor="#000000">
                    <table align=center width="100%" cellspacing="0" cellpadding="0" border="0" height="100%">
                        <tr>
                            <td bgcolor="#9999cc" height="4"><img src="imagens/x.gif" width="600" height="4">
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#000000" height="10"><img src="imagens/x.gif" width="600" height="10">
                            </td>
                        </tr>
                        <tr>
                            <td bgcolor="#9999cc" height="46" valign="top"><div align=center style="color:white; font-size: 10px"></div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </body>
</html:html>

Oi, Eduardo.

Seria melhor se você incluisse o trace do erro. Verifique o arquivo de log.

Mas apenas o trace do erro, por favor. :slight_smile:

Abraço.

O netbeans nao mostra o trace d erros com relacao a esse problema.
A unica coisa que aparece é essa msg HTTP Status 500… no browser.

Obrigado!

O netbeans nao mostra o trace d erros com relacao a esse problema.
A unica coisa que aparece é essa msg HTTP Status 500… no browser.

Obrigado!

Cara, não olhei todos os códigos, mas pelo que pude perceber parece que ele não está encontrado path /buscarCadastroFuncionario, acho que é isso.

Muito estranho isso. Já olhou se a estrutura de seus arquivos está certa e se seu web.xml está configurado certo tb?

Descobri o problema!!!

Na verdade o .class estava com o “a” do Action minúsculo. Eu alterei e compilei a classe umas mil vezes, entretanto ele nao substituia o .class com o nome errado pelo nome certo.

Enfim, o problema está solucionado! Mto Obrigado a todos que ajudaram!!!