Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML
 
 
Hot Web Programming Job

 

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML


 

Java Tutorials

Core Java
JSP
Servlet
JDBC
Hibernate
Struts 1
Struts 2
JSF
Spring
J2EE
J2ME
Web Services
Ajax
Dojo
MySQL
Latest Comments
Difference between
regarding reflecti
alert is not worki
book
dynamic reports
  All Comments...
 

 

 
Struts Tutorials
*Stuts TOC
*Apache Struts Introduction
* Struts Controller
* Struts Action Class
* Struts ActionFrom Class
* Using Struts HTML Tags
*Struts Validator Framework    
*Client Side Address Validation    
*Struts Tiles
*tiles-defs.xml
*Struts DynaActionForm
*Struts File Upload
*Struts DataSource
*AGGREGATING ACTIONS
*Internationalization
Struts Resources
*Struts Books
*Struts Articles
*Struts Frameworks
*Struts IDE
*Struts Alternative
*Struts Links
*Struts Presentations
*Struts Projects
*Struts Software
*Struts Reference
*Struts Resources
*Other Struts Tutorial
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
roseindia_net@yahoo.com
 
   

 
Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Struts Struts2 Struts 2 Hello World Files

User Comments
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl
  Blink   Furl   Simpy   Y! MyWeb 

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

58 comments so far (post your own) View All Comments Latest 10 Comments:

Hi, I have a weird problem. When I go to the address: http://localhost:8080/struts2tutorial/index.html the application works fine, however if I go to http://localhost:8080/struts2tutorial/ then the application redirects me to the http://localhost:8080/struts2tutorial/example/HelloWorld.action,
which is what the example index.html does (which I have deleted, rebuilt the whole application and restarted Tomcat). Does anybody know why this is happening?
Thanks

Posted by peter on Friday, 05.30.08 @ 17:45pm | #61448

Hi Andrew

I tried the solution posted by you to remove the namespace entry in the package tag. I still see the same error. Was anyone else successful in resolving this error?

Thanks
Krishna

Posted by Krishna on Wednesday, 05.7.08 @ 22:41pm | #58819

every thing is good but implement extra features in jdbc it not enough so pls do this .

Posted by praveen on Wednesday, 05.7.08 @ 17:24pm | #58797

Make sure you stop tomcat then remove the jar file you built ..

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\lib

then restart with the required change and your good to go

Posted by Will on Thursday, 05.1.08 @ 20:38pm | #58316

The solution was posted above:

This was set as /roseindia in the struts.xml file:

<package name="roseindia" namespace="/roseindia" extends="struts-default">

Instead, do this:

<package name="roseindia" extends="struts-default">

Posted by Andrew on Thursday, 05.1.08 @ 13:18pm | #58280

Change the index.html file it will work. the tutorial doesnt say that explicitly. The file is available at the source code struts2tutorial.zip

http://www.roseindia.net/struts/struts2/struts2tutorial.zip

Posted by Anuradha on Thursday, 04.17.08 @ 01:27am | #56746

can some body explain why Iam getting the following error
"SEVERE: Could not find action or result
There is no Action mapped for action name testAction. - [unknown location]".
I guess there is lot of mismatch with the jars that apache published, and there is no solution either form apache.Iam running a very simple application in MyEclipse6,if any body know the answer pl do post the answer..it saves lots of time
Thanks

Posted by prashanth on Wednesday, 04.2.08 @ 08:18am | #55088

I wonder why the ant doesn't build the war file so that I can work within Eclipse and deploy the war file to TomCat webapp directory, instead of working in TomCat webapp directory.

Only jar file is built but war is mention in 'dist' target.

Posted by Michael Wan on Monday, 03.24.08 @ 09:51am | #54030

I tried the below change, but I'm still getting the same error. Does this thing work?

Posted by Joshua Glickman on Monday, 03.24.08 @ 03:56am | #54006

I found the solution. The problem is the namespace.
This was set as /roseindia in the struts.xml file:

<package name="roseindia" namespace="/roseindia" extends="struts-default">

Instead, do this:

<package name="roseindia" extends="struts-default">

(which means the namespace will default to ""), which is what is needed.

Posted by bill edwards on Thursday, 03.20.08 @ 19:47pm | #53489

Trying to follow this tutorial but I too get

# Messages: There is no Action mapped for action name HelloWorld.

Stacktraces
There is no Action mapped for action name HelloWorld. - [unknown location]

com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
java.lang.Thread.run(Thread.java:619)


If anyone can help, please let me know at darrenkane@hotmail.com

Posted by Darren Kane on Friday, 02.29.08 @ 16:25pm | #50715

Hi,

I too got the same error: There is no Action mapped for action name HelloWorld.

Best regards,

Mounir

Posted by Mounir on Saturday, 02.9.08 @ 22:30pm | #47721

Hi,

After i did everything i got the compilation error.
that is

C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src>ant
Buildfile: build.xml

clean:
[delete] Deleting directory C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\classes
[mkdir] Created dir: C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\classes

prepare:

resources:

compile:
[javac] Compiling 1 source file to C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\classes
[javac] C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\java\net\roseindia\Struts2HelloWorld.java:2: cannot access com.opensymphon
y.xwork2.ActionSupport
[javac] bad class file: C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\lib\xwork-2.0.4.jar(com/opensymphony/xwork2/ActionSupport.clas
s)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] import com.opensymphony.xwork2.ActionSupport;
[javac] ^
[javac] 1 error

BUILD FAILED
C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\build.xml:82: Compile failed; see the compiler error output for details.

Total time: 1 second
C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src>
=================================================

I am using...
apache-ant-1.7.0
struts-2.0.11
Tomcat 5.5

Please help me here

Advance thanks

Posted by Umamaheswari on Wednesday, 02.6.08 @ 18:36pm | #47424

C:\tomcat5028\webapps\struts2tutorial\WEB-INF\src>ant
Buildfile: build.xml

BUILD FAILED
java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant
/util/FileUtils;
at org.apache.tools.ant.taskdefs.optional.dotnet.ImportTypelib.<clinit>(ImportTypelib.java:4
8)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.tools.ant.AntTypeDefinition.getTypeClass(AntTypeDefinition.java:161)
at org.apache.tools.ant.AntTypeDefinition.getExposedClass(AntTypeDefinition.java:135)
at org.apache.tools.ant.ComponentHelper.getElementName(ComponentHelper.java:577)
at org.apache.tools.ant.Project.getElementName(Project.java:1769)
at org.apache.tools.ant.IntrospectionHelper.getElementName(IntrospectionHelper.java:1087)
at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:513)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:368)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:322)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:191)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:133)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
at org.apache.tools.ant.Main.runBuild(Main.java:658)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds
java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant
/util/FileUtils;
at org.apache.tools.ant.taskdefs.optional.dotnet.ImportTypelib.<clinit>(ImportTypelib.java:4
8)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at org.apache.tools.ant.AntTypeDefinition.getTypeClass(AntTypeDefinition.java:161)
at org.apache.tools.ant.AntTypeDefinition.getExposedClass(AntTypeDefinition.java:135)
at org.apache.tools.ant.ComponentHelper.getElementName(ComponentHelper.java:577)
at org.apache.tools.ant.Project.getElementName(Project.java:1769)
at org.apache.tools.ant.IntrospectionHelper.getElementName(IntrospectionHelper.java:1087)
at org.apache.tools.ant.IntrospectionHelper.setAttribute(IntrospectionHelper.java:513)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:368)
at org.apache.tools.ant.RuntimeConfigurable.maybeConfigure(RuntimeConfigurable.java:322)
at org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:191)
at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:158)
at org.apache.tools.ant.Task.perform(Task.java:363)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:133)
at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:91)
at org.apache.tools.ant.Main.runBuild(Main.java:658)
at org.apache.tools.ant.Main.startAnt(Main.java:188)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant/util/FileUtils;
C:\tomcat5028\webapps\struts2tutorial\WEB-INF\src>


Posted by Prakash on Wednesday, 02.6.08 @ 11:28am | #47385

When I try to run my "ant" command. I am getting the following message..

BUILD FAILED
java.lang.NoSuchMethodError: org.apache.tools.ant.util.FileUtils.getFileUtils()Lorg/apache/tools/ant
/util/FileUtils

Posted by Prakash on Wednesday, 02.6.08 @ 11:27am | #47384

Hi,

After i did everything i got the status error,"There is no Action mapped for action name HelloWorld."

Can anybody tell why this doesnt maps?

Also, I dont use ant. But i do it using JDK1.5.
Is there any problem using JDK1.5 to compile it.

Tell me the steps how to configure and use ant.

Posted by tina on Wednesday, 01.30.08 @ 17:13pm | #46600

Struts Problem Report
Struts has detected an unhandled exception:

Messages: There is no Action mapped for action name HelloWorld.



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

Stacktraces
There is no Action mapped for action name HelloWorld. - [unknown location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:186)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
java.lang.Thread.run(Unknown Source)


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

You are seeing this page because development mode is enabled. Development mode, or devMode, enables extra debugging behaviors and reports to assist developers. To disable this mode, set:

struts.devMode=false

in your WEB-INF/classes/struts.properties file.

Posted by coolbyj on Wednesday, 01.2.08 @ 23:10pm | #44385

I am unable to download the source code. It's giving the invalid archive file error.
kindly solve the problem ASAP.
thanks,
Nagesh Bemini


Posted by nagesh on Thursday, 12.27.07 @ 16:49pm | #43953

I too got the same error...

=================================================
C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src>ant
Buildfile: build.xml

clean:
[delete] Deleting directory C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\classes
[mkdir] Created dir: C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\classes

prepare:

resources:

compile:
[javac] Compiling 1 source file to C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\classes
[javac] C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\java\net\roseindia\Struts2HelloWorld.java:2: cannot access com.opensymphon
y.xwork2.ActionSupport
[javac] bad class file: C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\lib\xwork-2.0.4.jar(com/opensymphony/xwork2/ActionSupport.clas
s)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] import com.opensymphony.xwork2.ActionSupport;
[javac] ^
[javac] 1 error

BUILD FAILED
C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\build.xml:82: Compile failed; see the compiler error output for details.

Total time: 1 second
C:\Program Files\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src>
=================================================

I am using...
apache-ant-1.7.0
struts-2.0.11
Tomcat 5.5

Please help me here

Advance thanks

Posted by Jeba on Sunday, 12.2.07 @ 01:08am | #41055


Stefan,
Download the source code from the above given link and see how index.html updated...

hope you manage to get this work

Harshi

Posted by Harshi on Monday, 11.19.07 @ 17:46pm | #37831

I've placed my struts.xml file in classes directory and do some modifications in build.xml as it generate errors.
1. target name="prepare"
copy file="classes/struts.xml"
todir="src/classes"

2. target name="clean"

delete dir="src/classes"
mkdir dir="src/classes"

my build was success but when I run the application it generate struts2tutorial is not available error.
What is the mistaken I have done? How can I overcome this?

Posted by harshi on Wednesday, 11.14.07 @ 16:25pm | #37374

Download the source code from the link provided and place the extracted content in the webapps folder of tomcat it will work.

Posted by Gayathri on Tuesday, 11.13.07 @ 21:32pm | #37254

Hi, are you sure that struts.xml is correct?
I think entries should follow in a different order

Posted by zlotech on Thursday, 11.8.07 @ 14:35pm | #36598

How should I change the index file?
What more do I have to do to make this work?
Has anyone managed to get this to work, or does anyone know a working tutorial plz help.

Thanks Stefan

Posted by Stefan on Monday, 11.5.07 @ 18:28pm | #35620

What is this ant-thing? there is no link to it?

Posted by Johannes on Monday, 11.5.07 @ 00:49am | #35534

"I am assuming that you have already installed ant build tool on your machine."

Why are you assuming that?
this ant-thing has not been mentioned earlier and there is no link to it, correct me if I am wrong.

Posted by Johannes on Monday, 11.5.07 @ 00:34am | #35533

WHEN WE OPEN ANY JSP PAGES WHY IT SHOW ON BROWSER :

java.lang.NullPointerException
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)


plz sent me response hurry

thanks & regards

Posted by ALOK KUMAR on Monday, 10.29.07 @ 10:08am | #35045

hi i too got the same error messages when ant is run

D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src>ant
Buildfile: build.xml

clean:
[delete] Deleting directory D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-IN
F\classes
[mkdir] Created dir: D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\clas
ses

prepare:

resources:

compile:
[javac] Compiling 1 source file to D:\JAVA\Tomcat 5.5\webapps\struts2tutoria
l\WEB-INF\src\classes
[javac] D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\java\net\rose
india\Struts2HelloWorld.java:2: cannot access com.opensymphony.xwork2.ActionSupp
ort
[javac] bad class file: D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\l
ib\xwork-2.0.4.jar(com/opensymphony/xwork2/ActionSupport.class)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of
the classpath.
[javac] import com.opensymphony.xwork2.ActionSupport;
[javac] ^
[javac] 1 error

BUILD FAILED
D:\JAVA\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\build.xml:82: Compile fai
led; see the compiler error output for details.

Total time: 1 second


plz fix the problem and let me know asap..

regards,
pavan

Posted by pavan on Friday, 10.19.07 @ 11:49am | #34382

I am using struts2 in netbeans.While running the programm i am getting servlet Exception action not mapped
--------------
index.jsp
----------

Posted by Shahid Pathan on Friday, 10.5.07 @ 11:53am | #31787

I modified the index.html and launched http://localhost:8080/Struts2Tutorial/index.html this is not mentioned either and fails on tomcat 6.0.14 so I tried on 5.5.23 and it worked. Not sure why, but it runs!

Posted by Ken on Friday, 10.5.07 @ 10:20am | #31772

Hello....this is nice site for learners even...
am thankful to this site...

Thanking You,

Regards,
Ramana Reddy

Posted by ramana on Tuesday, 10.2.07 @ 22:41pm | #31258

Problem:
Struts has detected an unhandled exception:
Messages: There is no Action mapped for action name HelloWorld.

Solution: You should also modify the index.html, which the author maybe have omitted.
The problem exist in the following:
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=example/HelloWorld.action">

Posted by Sophia on Saturday, 09.29.07 @ 14:00pm | #30472

I had the same problem encounter:

Struts has detected an unhandled exception:

Messages: There is no Action mapped for action name HelloWorld.

I had follow the tutorial and also update the index.html

Anyone got the solution?

Thanks

Posted by Lin Chong on Wednesday, 09.26.07 @ 09:30am | #29628

Hi,

I am also getting the same error when i try to submit a page .

""" There is no Action mapped for action name ""

I think the problem is how/from wehre the struts listner picks up the struts.xml, it seems the problem is where to keep the struts.xml.

One solutions i got is we have to keep the struts.xml in "classes" folder, but for me it's not working, if any one solved this issue, please let me know. rajagopal_yendluri@satyam.com

Posted by Rajagopal Y on Tuesday, 09.25.07 @ 15:10pm | #29318

Hi,

I am also getting the same error when i try to submit a page .

""" There is no Action mapped for action name ""

I think the problem is how/from wehre the struts listner picks up the struts.xml, it seems the problem is where to keep the struts.xml.

One solutions i got is we have to keep the struts.xml in "classes" folder, but for me it's not working, if any one solved this issue, please let me know. rajagopal_yendluri@satyam.com

Posted by Rajagopal Y on Tuesday, 09.25.07 @ 14:18pm | #29317

I downloaded "struts2-blank-2.0.9" and configured it as per this site to run the Struts2HelloWorld application.

The build was successful.

----------------------
Buildfile: build.xml

clean:
[delete] Deleting directory C:\Program Files\Apache Software Foundation\Tomca
t 5.5\webapps\struts2tutorial\WEB-INF\classes
[mkdir] Created dir: C:\Program Files\Apache Software Foundation\Tomcat 5.5\
webapps\struts2tutorial\WEB-INF\classes

prepare:
[copy] Copying 1 file to C:\Program Files\Apache Software Foundation\Tomcat
5.5\webapps\struts2tutorial\WEB-INF\src\classes

resources:

compile:
[javac] Compiling 1 source file to C:\Program Files\Apache Software Foundati
on\Tomcat 5.5\webapps\struts2tutorial\WEB-INF\src\classes
[jar] Building jar: C:\Program Files\Apache Software Foundation\Tomcat 5.5
\webapps\struts2tutorial\WEB-INF\lib\struts2tutorial.jar

project:

all:

BUILD SUCCESSFUL
Total time: 4 seconds
---------------------------------------

But when I am trying to open the HelloWorld.jsp page in the browser I am getting Null pointer exception.

-----------------------------------------------
HTTP Status 500 -

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

type Exception report

message

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:370)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NullPointerException
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
org.apache.jsp.example.HelloWorld_jsp._jspx_meth_s_text_0(org.apache.jsp.example.HelloWorld_jsp:127)
org.apache.jsp.example.HelloWorld_jsp._jspService(org.apache.jsp.example.HelloWorld_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
------------------------------------------------

I searched in google with this exception on this link

https://issues.apache.org/struts/browse/WW-1969

Plz assist me.
Thanks in advance.



Posted by Suraj Gupta on Tuesday, 09.11.07 @ 15:35pm | #26751

Dear All,

The only missing link in successful execution of this application is that you need to modify the index.html, which is not mentioned in the steps.
Change the index.html file, and it works.
Here is the file:

******
index.html...
******
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>RoseIndia.Net Struts 2 Tutorial</title>
</head>

<body>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td><font color="#000080" size="5"><b>RoseIndia.net Struts 2 Tutorials</b><br>
   </font></td>
</tr>
<tr>
<td><font color="#000080"><b>Select the following links to test the
examples</b></font></td>
</tr>
<tr>
<td>
<ul>
<li><a href="roseindia/HelloWorld.action">Run Struts 2 Hello World Application</a></li>
</ul>
</td>
</tr>
<tr>
<td><font color="#000080"> <br>
 <br>
 <br>
Visit <a href="http://www.roseindia.net">http://www.roseindia.net</a>
for latest tutorials</font></td>
</tr>
</table>
</center>
</div>
<p align="center"> </p>
</body>
</html>
**********
I hope this would resolve all the Issues.
Thanks..

Posted by Lokesh Kalra on Monday, 09.10.07 @ 12:17pm | #26565

hi, after i download and run i got the error msgs below.

C:\Tomcat\webapps\struts2tutorial\WEB-INF\src>ant
Buildfile: build.xml

clean:
[delete] Deleting directory C:\Tomcat\webapps\struts2tutorial\WEB-INF\classes
[mkdir] Created dir: C:\Tomcat\webapps\struts2tutorial\WEB-INF\classes

prepare:

resources:

compile:
[javac] Compiling 2 source files to C:\Tomcat\webapps\struts2tutorial\WEB-INF\src\classes
[javac] C:\Tomcat\webapps\struts2tutorial\WEB-INF\src\java\net\roseindia\Login.java:2: cannot access com.opensymphon
y.xwork2.ActionSupport
[javac] bad class file: C:\Tomcat\webapps\struts2tutorial\WEB-INF\lib\xwork-2.0.1.jar(com/opensymphony/xwork2/Action
Support.class)
[javac] class file has wrong version 49.0, should be 48.0
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac] import com.opensymphony.xwork2.ActionSupport;
[javac] ^
[javac] 1 error

BUILD FAILED
C:\Tomcat\webapps\struts2tutorial\WEB-INF\src\build.xml:55: Compile failed; see the compiler error output for details.

Total time: 3 seconds

expecting a reply asap
thank u

Posted by kishore on Friday, 09.7.07 @ 15:08pm | #26302

Hello,
I've tried the download code there is no problem but when I rebuilt the project using the ant build.xml,the execution of bach is ok but the project doesn't work on tomcat.

Did you have the same problem? Have you solve?

Thank you

Posted by Mallesh on Monday, 09.3.07 @ 11:43am | #24855

Hi,

when I followed the tutorial by creating files as explained, I got the below error when I have run the application.

Struts Problem Report

Struts has detected an unhandled exception:
# Messages: There is no Action mapped for action name HelloWorld.

I am got the output when I downloaded the source code and executed.
The reason is index.html need to be modified pointing to the roseindia/HelloWorld.action.


Thanks,
Swetha


Posted by Swetha on Tuesday, 08.28.07 @ 02:55am | #24289

Hi it downloaded your zip file and extracted it to my webapps folder in Tomcat5.5. However this example does not seem to work and i get 404 error(other apps with struts 1.1 work fine)
Even the examples given in Apache's Struts site does nt work.
Will you be able to help me out with the probable problem.
regards,
Varun

Posted by karthik on Wednesday, 08.22.07 @ 14:42pm | #23900

I've got an error listed below after running example downloaded from your webpage (got the same while trying to do this step by step using tutorial). And yes, I'm using tomcat 6.0.


Struts Problem Report

Struts has detected an unhandled exception:
# Messages: There is no Action mapped for action name HelloWorld.

Posted by Peter on Tuesday, 08.7.07 @ 17:17pm | #22869

Hello,
I've tried the download code there is no problem but when I rebuilt the project using the ant build.xml,the execution of bach is ok but the project doesn't work on tomcat.

Did you have the same problem? Have you solve?

Thank you


Posted by Gautier on Wednesday, 08.1.07 @ 13:51pm | #22421

Hi Karthik,

Run Struts 2 application on Tomcat 6 server.

Thanks

Posted by Deepak on Monday, 07.30.07 @ 23:50pm | #22244

I am trying to execute this in Tomcat 5 and i am gettting this error.

NFO: Installing web application at context path /struts2tutorial from URL file:D:\Tomcat 5.0\webapps\struts2tutorial
Jul 30, 2007 7:12:26 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart

Posted by Karthik on Monday, 07.30.07 @ 19:06pm | #22224

Hi Madhu,

You download the code and then install on the tomcat. It will work. If you find error please post here.

Thanks

Posted by Deepak Kumar on Wednesday, 07.25.07 @ 17:06pm | #21922

hey let me tell you one thing......
the people who are new to struts2 will try to execute the application but this is not working .
it disappoints me a lot.
............Madhu

Posted by Madhu on Wednesday, 07.25.07 @ 12:34pm | #21904

I known that the full integrated application working but application from tutorial doesn't work. It's good tutorial but maybe some more examples add for work(testing and learn Struts 2) without errors.

Thanks

Posted by Emiliozzz on Tuesday, 07.17.07 @ 12:00pm | #21423

Hi Mahendra,

I have just added a link to download the full integrated application. You download the application and then deploy it on your server. We have fully tested the application so it will 100% work.

Thanks
Deepak Kumar

Posted by Deepak Kumar on Friday, 07.13.07 @ 10:45am | #21188

your configuration does'nt work. I tested twice.

Posted by Mahendra on Friday, 07.13.07 @ 09:03am | #21182

this tutorial is not perfect first of all the first jsp is not there to be ...ie homepage.jsp .....rest all is fine but plz provide the full information one more thing is missing out from this for which i had faced the problem is Xalan.jar file is missing out from it's blank application for this problem it's not running.

Posted by VIkas on Wednesday, 07.11.07 @ 15:34pm | #21086

this is tutorial ??? step by step ? sorry but I think that is some sh... . When we create tutorial we must do this good ... and without problems then application must run (here is that ?)

Posted by Emiliozzz on Tuesday, 07.10.07 @ 13:30pm | #21020

Here is a work around to get it working in eclipse 3.2. Get WTP plugins for eclipse. Create DynamicWebProject. The below is what the project structure will look like:

projectname --> Name of the projct in eclipse
src
com.yourcompname -->place your java files
strut.xml
web
css ---> This folder contains CSS files
pages ---> This folder contains JSPs
WEB-INF
classes --> classes, strut.xml
lib --> library files
libext --> library files
web.xml
index.jsp or index.html

The below is a build.xml which would deploy the application as war file in JBOSS. This build.xml assumes JBOSS resides in the root location. A little or no modifcation would be required in this file if need be.

<?xml version="1.0"?>
<!-- This build file builds for JBoss -->
<project name="strut2application" default="deploy" basedir=".">
<property name="jboss.home.dir" value="/jboss-4.0.0"/>
<property name="jboss.deploy.dir" value="${jboss.home.dir}/server/default/deploy"/>
<property name="src.dir" value="src" />
<property name="cls.dir" value="WebRoot/WEB-INF/classes" />
<property name="web.dir" value="WebRoot"/>
<property name="build.dir" value="build"/>
<property name="war" value="${build.dir}/struts2Proj.war" />
<property name="war.web.xml" value="${web.dir}/WEB-INF/web.xml" />
<property name="web.cls.dir" value="WebRoot/WEB-INF/classes"/>

<!--Clean the project workspace -->
<target name="clean" description="Clean Packaging">
<delete dir="${build.dir}"/>
</target>
<!-- compile -->
<target name="compile" depends="clean" description="o Compile the code">
<javac
srcdir="${src.dir}"
destdir="${cls.dir}"
deprecation="true"
debug="false"
optimize="false">
</javac>
</target>

<!-- copy needed files to build so that we could distribute it -->

<target name="copyfiles" depends="clean">
<copydir src="${cls.dir}" dest="${build.dir}/WEB-INF/classes"></copydir>
<!-- <copyfile src="MessageResources.properties" dest="${build.dir}//WEB-INF/classes/MessageResources.properties"/>-->
<copy todir="${build.dir}">
<fileset dir="${web.dir}"></fileset>
</copy>
</target>

<!-- deploy the application as a war file -->
<target name="web.package" depends="copyfiles" description="Packages the Web classes">
<echo>Generating WAR</echo>
<war warfile="${war}" webxml="${war.web.xml}">
<fileset dir="${build.dir}" includes="**" excludes="${war.web.xml}"/>
</war>
</target>

<target name="deploy" depends="web.package" description="Deploys WAR on Jboss Server">
<echo>Deploying struts2Proj.war</echo>
<copy file="${war}" todir="${jboss.deploy.dir}" overwrite="true"/>
</target>

</project>


That should be it I guess.

Note: We dont need WTP plugin for eclipse if we use WSAD (from IBM) or MyEclipse (from Genuitec). If we use MyEclipse, we dont require even the build.xml as it has a wizard option to deploy our application in exploded or packaged mode in our respective application or web servers


Thanks,

Chandra

Posted by Chandramohan P L on Thursday, 07.5.07 @ 14:42pm | #20763

The article says that "By default web.xml file of struts blank application is configured to route all the request for *.action through org.apache.struts2.dispatcher.FilterDispatcher." and the configuration of web.xml is highlighted.

The question is where is '*.action' mentioned in the config? web.xml contains the mapping of all requests, since the URL patters is '/*'.

I think either the text should be fixed, or the mechanism should be cleared up.

Posted by danissimo on Wednesday, 06.27.07 @ 16:39pm | #20279

The HelloWorld.jsp has to be located in struts2tutorial\roseindia\pages NOT in struts2tutorial\pages as mentioned. The package namespace /roseindia in struts.xml anticipates HelloWorld.jsp in struts2tutorial\roseindia\pages.
It took me a while to figure this out as I am new to struts 2 package declaration.

Posted by struts2coder on Wednesday, 06.13.07 @ 21:04pm | #19135

hi,
Need to run the application in eclipse 3.2. can anybody help me in this regard for running the HelloWorld application.

Posted by priyanka on Wednesday, 06.13.07 @ 18:16pm | #19121

HI,

- We have added index.html file to add the link to call all the tutorials present. You can remove index.html with your project file.
- the build.xml creates the "classes" folder under the src folder...
Acuall build.xml file first compiles the java files and stores in the src/classes directory. Then it creates jar file and place in the WEB-INF/lib directory. So, no need to place compiled files in WEB-INF/classes directory.

Hope this will help you.
Thanks


Posted by Deepak Kumar on Monday, 06.11.07 @ 23:05pm | #18928

Hello, a few things seem wrong in this tutorial:
- how are we supposed to get that Struts 2 tutorial? we never altered index.html from the blank war file.
- the build.xml creates the "classes" folder under the src folder, and not under WEB-INF; doesn't the framework require the classes to be under WEB-INF/classes?

Please let me know how to fix this and make it work, I'd like to have a working skeleton that I could put together as the start of a bigger project.

Thanks,
Session

Posted by Session on Monday, 06.11.07 @ 21:18pm | #18923

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Back to Tutorial

 

  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification

Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.