Bom dia galera, tudo bem?
Bom, procurei por este tipo de erro em inumeros sites e foruns, até achei alguns parecidos, mas não obtive resposta da solução.
Seguinte, como muitos aqui, estou executando um código simples da apostila da caelum e está dando erro… bom, vamos aos códigos.
ActionSimples.java
package br.com.thiago.struts.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class ActionSimples extends Action{
public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception{
System.out.println("Running...");
return map.findForward("ok");
}
}
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://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
<action-mappings>
<action path="/teste" type="br.com.thiago.struts.action.ActionSimples">
<forward name="ok" path="/exemplo.jsp"/>
</action>
</action-mappings>
<!-- Arquivo de Mensagens -->
<message-resources parameter="MessageResources"/>
</struts-config>
web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns ="http://java.sun.com/xml/ns/j2ee" version="2.4">
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
erro
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.ClassNotFoundException: br.com.thiago.struts.action.ActionSimples
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
java.lang.ClassNotFoundException: br.com.thiago.struts.action.ActionSimples
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1360)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1206)
org.apache.struts.chain.commands.util.ClassUtils.getApplicationClass(ClassUtils.java:54)
org.apache.struts.chain.commands.util.ClassUtils.getApplicationInstance(ClassUtils.java:71)
org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98)
org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:68)
org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:90)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.
Coloquei todos os jars do struts no lib e adicionei todos ao classpath e mesmo assim, ele não consegue achar, executar minha action.
Se alguem puder me ajudar, agradeço…
Abraços