Problema no struts-config.xml

Pessoal, alguem saberia me dizer porque ocorre esse erro no Tomcat 5.5.4 quando eu adiciono isso ao struts-config.xml?

<form-beans> <form-bean dynamic="false" name="saveEditEmpresaForm" type="SaveEditEmpresaForm"> </form-beans>

Sendo que no action-mapping tenho esse action:

    <action
            path="/saveEditEmpresa"
            type="SaveEditEmpresaAction"
            attribute="saveEditEmpresaForm"
            input="/pages/editEmpresa.jsp"
            name="saveEditEmpresaForm"
            scope="session"
            unknown="false"
            validate="true">
            <forward name="success"
                      path="/pages/listaEmpresa.jsp"
                      redirect="false"
                      contextRelative="false" />
        </action> [/code]

Erro no Tocat:
[code]exception

org.apache.jasper.JasperExceptionorg.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:446)
org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:329)
org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectTag.java:296)
org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:270) [/code]

Se eu retira a parte do form-beans do struts-config, aparece esse erro, quando tento editar os dados da empresa para alterar, pois ele acusa (claro) que o form bean nao foi informado mas se eu informo ele nem executa o projeto:

[code]exception

javax.servlet.ServletException: Cannot retrieve definition for form bean  saveEditEmpresaForm on action /saveEditEmpresa.do
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778) 
...

Entao nao entendo, se coloco nem carrega o projeto, se nao coloco (obvio) acusa a falta do form bean que edita os dados.

O que devo fazer?

sua classe SaveEditEmpresaForm não esta em nenhum pacote??
se esta vc precisa dar o nome completo da classe.

[]'s

Nao, as classes estao todas no mesmo local, por isso eu nao informei o nome com o nome do pacote tambem.

cara, a principio ta correto.

tira o “dynamic” da tag do form bean, nunca usei ela, e tira o “attribute” da tag da action, vc não precisa passar seu form como atributo.
da uma tentada ae.

[]'s

deixei assim:

    <form-beans>
        <form-bean name="saveEditEmpresaForm"
                   type="SaveEditEmpresaForm"    

    </form-beans>

	<action
        	path="/saveEditEmpresa"
        	type="SaveEditEmpresaAction"
        	input="/pages/editaEmpresa.jsp"
        	name="saveEditEmpresaForm"
        	scope="session"
        	unknown="false"
        	validate="true">
        	<forward name="success"
            	 	 path="/pages/listaEmpresa.jsp"
            	 	 redirect="false"
            	 	 contextRelative="false" />
        </action>

Continua dando o mesmo erro:

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NullPointerException
	org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:446)
	org.apache.struts.taglib.TagUtils.computeURLWithCharEncoding(TagUtils.java:329)
	org.apache.struts.taglib.logic.RedirectTag.generateRedirectURL(RedirectTag.java:296)
	org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:270)
	org.apache.jsp.index_jsp._jspx_meth_logic_redirect_0(org.apache.jsp.index_jsp:87)
	org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:59)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Putz, nao sei o que fazer…

Classe SaveEditEmpresaForm:

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 SaveEditEmpresaForm extends ActionForm {

    private String razaoSocial;
    private String CNPJ;

    public void reset(ActionMapping mapping, HttpServletRequest request) {
        razaoSocial = "";
        CNPJ = "";
    }

    public ActionErrors validate(
        ActionMapping mapping,
        HttpServletRequest request) {

        ActionErrors errors = new ActionErrors();
        if ((razaoSocial == null) || (razaoSocial.length() < 1)) {
            errors.add("razaoSocial", new ActionError("error.empresa.razaoSocial.requerida"));
        }
        if ((CNPJ == null) || (CNPJ.length() < 1)) {
            /* Aqui fazer a validacao do CNPJ */
            errors.add("CNPJ", new ActionError("error.empresa.cnpj.requerida"));
        }
        return errors;
    }

    public String getRazaoSocial() {
        return this.razaoSocial;
    }
    public void setNovaRazaoSocial(String p) {
        this.razaoSocial = p;
    }
    public String getCNPJ() {
        return this.CNPJ;
    }
    public void setCNPJ(String p) {
        this.CNPJ = p;
    }
}

Classe SaveEditEmpresaAction:

import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;

import org.apache.commons.beanutils.BeanUtils;
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;

public class SaveEditEmpresaAction extends Action {

    public ActionForward execute(
        ActionMapping mapping,
        ActionForm form,
        HttpServletRequest request,
        HttpServletResponse response)
        throws Exception {
        ActionErrors errors = new ActionErrors();
        try {
            HttpSession session = request.getSession();
            SaveEditEmpresaForm editEmpresaForm = (SaveEditEmpresaForm)form;
            BeanEmpresa empresa = (BeanEmpresa)session.getAttribute("editEmpresaBean");

            if (errors.isEmpty()) {
                BeanUtils.copyProperties(empresa, editEmpresaForm);
                DataSource dataSource = getDataSource(request);
                AdminEmpresa adminEmpresa = new AdminEmpresa();
                adminEmpresa.setUpdateEmpresa(empresa);
            }
        }
        catch (SQLException e) {
            errors.add(ActionErrors.GLOBAL_ERROR,new ActionError("error.empresa.atualizando"));
            getServlet().log("Erro alterando os dados da Empresa", e);
        }


        if (!errors.isEmpty()) {
            saveErrors(request, errors);
            return (mapping.findForward("failure"));
        }
        else {
            return (mapping.findForward("success"));
        }
    }
}

Não sei se foi erro de digitação seu, mas vc fechou o form-bean??

&lt;form-beans&gt;
     &lt;form-bean dynamic="false"
                name="saveEditEmpresaForm"
                type="SaveEditEmpresaForm"&gt;
    &lt;/form:bean&gt;
 &lt;/form-beans&gt; 

Cara que vergonha!!! :frowning: Era isso.

Mas tem mais um problema, se puder ajudar agradeco (ja que fiquei totalmente zureta com aquele outro erro esse pode ta na minha cara mas nao estou conseguindo ver)

Meu form-bean ficou assim:

    <form-beans>
	<form-bean name="saveEditEmpresaForm"
                   type="SaveEditEmpresaForm"/>

    </form-beans>

Meu action-mapping ficou assim:

    <action-mappings>
	<action name="SaveEditEmpresaForm"
        	path="/saveEditEmpresa"
        	type="SaveEditEmpresaAction"
        	input="/pages/editaEmpresa.jsp"
        	scope="session"
        	unknown="false"
        	validate="true">
        	<forward name="success"
            	 	 path="/pages/listaEmpresa.jsp"
            	 	 redirect="false"
            	 	 contextRelative="false" />
        </action>
        
        <action path="/Welcome"
            	forward="/pages/Welcome.jsp"/>
        
        <action path="/Empresa"
            	forward="/pages/empresa.jsp"/>
        
        <action path="/Inicio"
            	forward="/pages/inicio.jsp"/>
        
        <action path="/EditarEmpresa"
            	forward="/pages/editaEmpresa.jsp"/>

	<action
            	path="/listEmpresa"
            	type="ListEmpresaAction">
        	<forward name="success" path="/pages/listaEmpresa.jsp" />
        </action>

	<action
            	path="/editEmpresa"
            	type="EditEmpresaAction">
        	<forward name="success" 
        	         path="/pages/editaEmpresa.jsp" 
        	         redirect="false" 
        	         contextRelative="false"/>
        </action>
    </action-mappings>

Meu globa-forward ficou assim:

    <global-forwards>
        <forward name="inicio"
            	 path="/Inicio.do"/>
        
        <forward name="welcome"
            	 path="/Welcome.do"/>
        
        <forward name="empresa"
            	 path="/Empresa.do"/>
        
        <forward name="editarEmpresa"
            	 path="/EditarEmpresa.do"/>
    </global-forwards>

Tenho esse JSP que cria um link com o CNPJ quando clico no link era pra abrir a JSP que edita os dados da empresa (apenas 2 campos):

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>

<logic:notPresent name="empresaListBean" scope="session">
  <logic:redirect forward="error"/>
</logic:notPresent>

<html:html locale="true">
<head>
  <title><bean:message key="form.empresa.listar"/></title>
</head>
<body>
    <center>        
        <blockquote>
            <center>
                <h3><font color="blue"><bean:message key="form.empresa.listar"/></font></h3>
                
                <table width="80%" border="1">
                    
                    <%-- loop que percorre a Collection de empresas (no caso apenas 1) --%>
                    <logic:iterate name="empresaListBean" id="empresa" >
                        <TR>
                         <TD WIDTH="20%"><font face="Arial" size="2"><bean:message key="form.empresa.prompt.nome"/></TD>
                         <TD><font face="Arial" size="2">
                             <html:link page="/EditarEmpresa.do"
                                		   paramId="CNPJ"
                                		   paramName="empresa"
                                		   paramProperty="CNPJ">
                            <bean:write name="empresa" property="razaoSocial"/></TD>
                            </html:link>
                        </TR>
                        
                        <TR>
                         <TD><font face="Arial" size="2"><bean:message key="form.empresa.prompt.cnpj"/></TD>
                         <TD><font face="Arial" size="2"><bean:write name="empresa" property="CNPJ"/></TD>
                        </TR>
                    </logic:iterate>                    
                </table>
                
                <br/>
                <html:link page="/inserirEmpresa.do">incluir</html:link>
                <html:link page="/Welcome.do">Página Inicial</html:link>
            </center>
        </lockquote>
    </body>
</html:html>

JSP para editar os dados da empresa (apenas 2 dados, Razao Social e CNPJ)

<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<html:html locale="true">
    <head>
        <title><bean:message key="form.empresa.titulo"/></title>
    </head>
    <body>
        <font face="Arial" size="3">
            <center>
                <h3><font color="blue"><bean:message key="form.empresa.editar"/></font></h3>
                <html:form action="/saveEditEmpresa.do"  method="post" focus="login">
                    <html:hidden property="CNPJ" name="editEmpresaBean"/>
                    <table width="80%" border="0">
                        <tr>
                            <td width="30%"></td>
                            <td width="70%">
                            
                                <%-- exibe os erros de validação --%>
                                <logic:messagesPresent>
                                    <ul>
                                        <html:messages id="error">
                                            <li><bean:write name="error"/></li>
                                        </html:messages>
                                    </ul>
                                </logic:messagesPresent>
                            </td>
                        <tr>
                        <tr>
                            <td align="right"><bean:message key="form.empresa.prompt.cnpj"/>: </td>
                            <td align="left"><b><bean:write property="CNPJ" name="editEmpresaBean"/></b></td>
                        </tr>

                        <tr>
                            <td align="right"><bean:message key="form.empresa.prompt.nome"/>: </td>
                            <td align="left"><html:text property="razaoSocial" name="editEmpresaBean" size="20"/></td>
                        </tr>

                        <tr>
                            <td colspan="2" align="center">
                                <html:submit><bean:message key="botao.enviar"/></html:submit>
                                <html:reset><bean:message key="botao.cancelar"/></html:reset>
                            </td>
                        </tr>
                    </table>
                </html:form>
                <br/>
                <html:link page="/listEmpresa.do">Voltar</html:link>
            </center>
        </font>
    </body>
</html:html>

Porem quando clico no link da essa exception:

exception

javax.servlet.ServletException: Cannot retrieve definition for form bean SaveEditEmpresaForm on action /saveEditEmpresa.do
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:845)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:778)
	org.apache.jsp.pages.editaEmpresa_jsp._jspService(org.apache.jsp.pages.editaEmpresa_jsp:263)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
	org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
	org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994)
	org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:343)
	org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.jsp.JspException: Cannot retrieve definition for form bean SaveEditEmpresaForm on action /saveEditEmpresa.do
	org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:731)
	org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
	org.apache.jsp.pages.editaEmpresa_jsp._jspService(org.apache.jsp.pages.editaEmpresa_jsp:125)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)
	org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)
	org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(RequestProcessor.java:994)
	org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward(TilesRequestProcessor.java:343)
	org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.java:553)
	org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:211)
	org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Agradeceria muito se alguem me desse uma dica, pode ser algum detalhe que nao estou conseguindo perceber (provavelmente com certeza).