• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Struts2 config error

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)...
 
Shashank Bekal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ankit,

I have updated the post with code tags. I hope this helps.
 
Did you just should on me? You should read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic