aspose file tools*
The moose likes Struts and the fly likes Struts2 config error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 config error" Watch "Struts2 config error" New topic
Author

Struts2 config error

Shashank Bekal
Greenhorn

Joined: Jan 27, 2010
Posts: 2
Hi,

I am new to Struts2 and I am developing my first application. I am getting this error which has almost made me Quit. Please help me how can I get rid of this and run my application.

IDE: Eclipse Galileo(3.5.1)
Server: Tomcat 6.0

Folder Structure:
--------------------

SecondAttempt
|src
||org
|||shankze
||||action
|||||HelloWorld.java
|WebContent
||jsp
|||HelloWorld.jsp
|||index.jsp
||WEB-INF
|||lib
||||jars
|||struts.xml
|||web.xml
|.classpath
|.project

Jars inside SecondAttempt/WebContent/Web-INF/lib/
commons-logging-1.0.4
commons-logging-api-1.1
freemarker-2.3.8
ognl-2.6.11
struts2-core-2.0.14
xwork-2.0.7

Code:
--------

Web.xml
-----------------------------

-----------------------------

struts.xml
-----------------------------

-----------------------------

index.jsp
-----------------------------

-----------------------------

HelloWorld.jsp
-----------------------------

-----------------------------

HelloWorld.java
-----------------------------

-----------------------------


When I run this code I get this error:
-----------------------------
Jan 28, 2010 12:16:27 AM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jan 28, 2010 12:16:27 AM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/29 config=null
Jan 28, 2010 12:16:27 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1070 ms
Jan 28, 2010 12:16:32 AM org.apache.struts2.components.ActionComponent executeAction
SEVERE: Could not execute action: //jsp/HelloWorld
There is no Action mapped for namespace //jsp and action name HelloWorld. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
at org.apache.struts2.components.ActionComponent.executeAction(ActionComponent.java:249)
at org.apache.struts2.components.ActionComponent.end(ActionComponent.java:155)
at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:43)
at org.apache.jsp.jsp.index_jsp._jspx_meth_s_005faction_005f0(index_jsp.java:96)
at org.apache.jsp.jsp.index_jsp._jspService(index_jsp.java:66)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:416)
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:128)
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:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Unknown Source)

Please tell me if the problem is with the folder structure or the links or something else.
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9305
    
  17

Hi Shashank, welcome to javaranch.

Shashank please Use Code Tags when you post a source code. That way your code looks formatted. Unformatted code is hard to read. You can add code tags by wrapping your code in [code] [/code] tags. You can edit your message using button and then add code tags to it.

As the error indicates, struts is looking for an action named HelloWorld in /jsp namespace because your index.jsp is in the /jsp folder. If an action is not found in a namespace, struts looks for that action in the default namespace. I don't know why struts is not looking for HelloWorld action in default namespace, David can throw light on it (maybe I missed something). Also check if you have all the dependencies in your application's libraries (struts 2.0.14)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Shashank Bekal
Greenhorn

Joined: Jan 27, 2010
Posts: 2
Ankit,

I have updated the post with code tags. I hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts2 config error