Instalação Struts 2

9 respostas
F

Bom, primeiramente desculpe se postei no lugar errado, sou novo no forum!

Bom eu fiz o curso de formação java na caelum tem mais de 1 ano.
Sou programador a algum tempo, porem, não mecho com java desde a epoca que fiz o curso.

Estou tomando sufoco pra configurar struts2, acreditem se quiser =//

seguinte, aparece q seguinte msg:

http://localhost:8080/fj21-tarefas/olaMundoStruts

[b]HTTP Status 404 - There is no Action mapped for namespace / and action name olaMundoStruts.

type Status report

message There is no Action mapped for namespace / and action name olaMundoStruts.

description The requested resource (There is no Action mapped for namespace / and action name olaMundoStruts.) is not available.[/b]

olaMundoAction.java

package br.com.caelum.tarefas.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

public class OlaMundoAction {
	@Action(value = "olaMundoStruts", results = {
		@Result(location = "olaMundoStruts.jsp", name = "ok")}
	)
	
	public String execute(){
		System.out.println("Executando a lógica com Struts 2");
		return "ok";
	}
}

olaMundoStruts.jsp

Hello World whit Struts

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>franktoys</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  
  <filter>
  	<filter-name>struts2</filter-name>
  	<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  
  <filter-mapping>
  	<filter-name>struts2</filter-name>
  	<url-pattern>/*</url-pattern>
  </filter-mapping>
  
</web-app>

struts.xml

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

Bom esses sao os arquivos do curso, nao sei oque pode ta errado, o TOMCAT roda le o .jsp mas nao le a action que chama o jsp!
Fico no aguardo!

vlwww

9 Respostas

F

Ninguem?
pó ja tentei de tudo, não sei se é a droga do TOMCAT!
ajudem ae pls!

vinnysoft

Cara tambem to apanhando do Struts. Voce usou quais jars?

Dei uma olhada em outros topicos, e me parece que é algo com incompatibilidade de jars.

R

Kra eu tb estava com esse problema, so consegui solucionar o problema colocando meus jar’s na pasta

WEB-INF
lib (commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.0.4.jar
freemarker-2.3.15.jar
ognl-2.7.3.jar
struts2-convention-plugin-2.1.8.1.jar
struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar )

Só para constar estou usando o Tomcat 7.0

F

Eu uso tds esses jars, eu acho q é algo com eclipse e tomcat!
;/

F
AVISO: Could not find action or result

There is no Action mapped for namespace / and action name olaMundoStruts. - [unknown location]

at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)

at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)

at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)

at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:47)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:478)

at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:91)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

at java.lang.Thread.run(Unknown Source)
vinnysoft

Nao é problema do eclipse + tomcat nao, pq uso Netbeans e glassfish e nao consigo do mesmo jeito. Tambem ja coloquei essas jars.

renatorudolf

Estou com esse mesmo problema tb, ja coloquei na minha web-inf/lib todos esses jars

só que uso, o tomcat 6, sera q o problema esta na versao do mesmo ?

A mensagem de erro que da é:
HTTP Status 404 -
type Status report
message
description The requested resource () is not available.
Apache Tomcat/6.0.20

Alguem mais ja passo por isso ?

ViniGodoy

Movido para o fórum de desenvolvimento web. Por favor, leia atentamente a descrição dos fóruns antes de postar.

renatorudolf

Foi mal ViniGodoy, tem o link ai, que continua esse post ?

Criado 14 de abril de 2011
Ultima resposta 26 de mai. de 2011
Respostas 9
Participantes 5