Struts2 Dzone
Struts2 Dzone
Login
Join DZone
Home Search
Welcome to the Part 2 of 7-part series where we will explore the We Recommend These Resources
world of Struts 2 Framework. In previous article we went through
Java EE & Servlet Containers for ColdFusion
the basics of Struts2, its Architecture diagram, the request
Developers
processing lifecycle and a brief comparison of Struts1 and Struts2.
Free Trial: InstallAnywhere 2009 for Java-Based
If you have not gone through the previous article, I highly
Setups
recommend you to do that before starting hands-on today.
Code Signing for Adobe AIR Applications
Struts 2 Tutorial List VeriSign Authenticated Content Signing
• Part 1: Introduction to Struts 2 Framework How to Digitally Sign Downloadable Code for
• Part 2: Create Hello World Application in Struts 2 Secure Content Transfer
• Part 3: Struts 2 Validation Framework Tutorial with Example
• Part 4: Struts 2 Tiles Plugin Tutorial with Example
About the author
• Part 5: Struts 2 Interceptors Tutorial with Example
First Name: Viral
• Part 6: Struts 2 File Upload and Save Example
Last Name: Patel
• Part 7: Struts 2 Ajax Tutorial with Example Posts: 11
Related: Create Struts Application with Eclipse Joined: 12/03/2008
Things We Need View full user profile
Before we starts with our first Hello World Struts 2 Example, we will need few tools.
Popular at DZone
NetBeans 7.0
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 2 of 11
Write the name of the project. For example StrutsHelloWorld. Once this is done, select the target runtime environment
(e.g. Apache Tomcat v6.0). This is to run the project inside Eclipse environment. After this press Finish.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 3 of 11
Once the project is created, you can see its structure in Project Explorer.
Now copy all the required JAR files in WebContent -> WEB-INF -> lib folder. Create this folder if it does not exists.
Open web.xml file which is under WEB-INF folder and copy paste following code.
The above code in web.xml will map Struts2 filter with url /*. The default url mapping for struts2 application will be /*.action.
Also note that we have define Login.jsp as welcome file.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 4 of 11
Note that, above action class contains two fields, username and password which will hold the values from form and also
contains an execute() method that will authenticate the user. In this simple example, we are checking if username is admin
and password is admin123.
Also note that unlike Action class in Struts1, Struts2 action class is a simple POJO class with required attributes and
method.
The execute() method returns a String value which will determine the result page. Also, in Struts2 the name of the method is
not fixed. In this example we have define method execute(). You may want to define a method authenticate() instead.
The ResourceBundle
ResourceBundle is very useful Java entity that helps in putting the static content away from the source file. Most of the
application define a resource bundle file such as ApplicationResources.properties file which contains static messages such
as Username or Password and include this with the application.
ResourceBundle comes handy when we want to add Internationalization (I18N) support to an application.
We will define an ApplicationResources.properties file for our application. This property file should be present in WEB-
INF/classes folders when the source is compiled. Thus we will create a source folder called resources and put the
ApplicationResources.properties file in it.
To create a source folder, right click on your project in Project Explorer and select New -> Source Folder.
1. label.username= Username
2. label.password= Password
3. label.login= Login
The JSP
We will create two JSP files to render the output to user. Login.jsp will be the starting point of our application which will
contain a simple login form with username and password. On successful authentication, user will be redirected to
Welcome.jsp which will display a simple welcome message.
Create two JSP files Login.jsp and Welcome.jsp in WebContent folder of your project. Copy following content into it.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 5 of 11
Login.jsp
01. <%@ page contentType="text/html; charset=UTF-8"%>
02. <%@ taglib prefix="s" uri="/struts-tags"%>
03. <html>
04. <head>
05. <title>Struts 2 - Login Application | ViralPatel.net</title>
06. </head>
07. <body>
08. <h2>Struts 2 - Login Application</h2>
09. <s:actionerror />
10. <s:form action="login.action" method="post">
11. <s:textfield name="username" key="label.username" size="20" />
12. <s:password name="password" key="label.password" size="20" />
13. <s:submit method="execute" key="label.login" align="center" />
14. </s:form>
15. </body>
16. </html>
Welcome.jsp
01. <%@ page contentType="text/html; charset=UTF-8"%>
02. <%@ taglib prefix="s" uri="/struts-tags"%>
03. <html>
04. <head>
05. <title>Welcome</title>
06. </head>
07. <body>
08. <h2>Howdy, <s:property value="username" />...!</h2>
09. </body>
10. </html>
Note that we have used struts2 <s:> tag to render the textboxes and labels. Struts2 comes with a powerful built-in tag library
to render UI elements more efficiently.
Note that in above configuration file, we have defined Login action of our application. Two result paths are mapped with
LoginAction depending on the outcome of execute() method. If execute() method returns success, user will be redirected to
Welcome.jsp else to Login.jsp.
Also note that a constant is specified with name struts.custom.i18n.resources. This constant specify the resource bundle
file that we created in above steps. We just have to specify name of resource bundle file without extension
(ApplicationResources without .properties).
Our LoginAction contains the method execute() which is the default method getting called by Sturts2. If the name of method
is different, e.g. authenticate(); then we should specify the method name in <action> tag.
Almost Done
We are almost done with the application. You may want to run the application now and see the result yourself. I assume you
have already configured Tomcat in eclipse. All you need to do:
Open Server view from Windows -> Show View -> Server. Right click in this view and select New -> Server and add your
server details.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 6 of 11
To run the project, right click on Project name from Project Explorer and select Run as -> Run on Server (Shortcut:
Alt+Shift+X, R)
But there is one small problem. Our application runs perfectly fine at this point. But when user enters wrong credential, she
is redirected to Login page. But no error message is displayed. User does not know what just happened. A good application
always show proper error messages to user. So we must display an error message Invalid Username/Password. Please try
again when user authentication is failed.
Final Touch
To add this functionality first we will add the error message in our ResourceBundle file.
Open ApplicationResources.properties and add an entry for error.login in it. The final ApplicationResources.properties will
look like:
1. label.username= Username
2. label.password= Password
3. label.login= Login
4. error.login= Invalid Username/Password. Please try again.
Also we need to add logic in LoginAction to add error message if user is not authenticated. But there is one problem. Our
error message is specified in ApplicationResources.properties file. We must specify key error.login in LoginAction and the
message should be displayed on JSP page.
For this we must implement com.opensymphony.xwork2.TextProvider interface which provides method getText(). This
method returns String value from resource bundle file. We just have to pass the key value as argument to getText() method.
The TextProvider interface defines several method that we must implement in order to get hold on getText() method. But we
don’t want to spoil our code by adding all those methods which we do not intend to use. There is a good way of dealing with
this problem.
Struts2 comes with a very useful class com.opensymphony.xwork2.ActionSupport. We just have to extend our LoginAction
class with this class and directly use methods such as getText(), addActionErrors() etc. Thus we will extend the LoginAction
class with ActionSupport class and add the logic for error reporting into it. The final code in LoginAction must look like:
And that’s it. Our first Hello World Struts2 Application is now ready.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 7 of 11
Welcome page
Moving On
Now that we have created our first webapp using Struts2 framework, we know how the request flows in Struts2. We also
know the use of struts.xml and properties file. In this application we implemented a preliminary form of validation. In next
part we will learn more about Validation Framework in Struts2 and implement it in our example.
From: http://viralpatel.net/blogs/
Your rating:
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)
Comments
I'd really recommend using a more recent version of Struts 2 for new tutorials.
Hello, I tried to run Struts HelloWorld, but Igot the following Exception: Unable to load configuration. -
bean -
jar:file:/C:/ecl_hiber_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration
(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration
(Dispatcher.java:374) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418) at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190) at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:108) at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3800) at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4450) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 8 of 11
org.apache.catalina.core.StandardHost.start(StandardHost.java:722) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at
org.apache.catalina.core.StandardService.start(StandardService.java:516) at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at
org.apache.catalina.startup.Catalina.start(Catalina.java:583) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start
(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by:
Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest
class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean -
jar:file:/C:/ecl_hiber_ws/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:221) at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register
(StrutsXmlConfigurationProvider.java:101) at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer
(DefaultConfiguration.java:169) at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration
(ConfigurationManager.java:55) ... 21 more Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/fileupload/FileUploadException at java.lang.Class.getDeclaredConstructors0
(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at
java.lang.Class.getDeclaredConstructors(Unknown Source) at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:211) ... 24 more Caused by: java.lang.ClassNotFoundException:
org.apache.commons.fileupload.FileUploadException at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387) at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233) ... 28
more
Heinrich Winter if you have created struts.properties you need to add the resource there instead of
the struts.xml file
struts.custom.i18n.resources=ApplicationResources,languages_actions,languages_views
removed this.
Hi, I'm really new to struts and eclipse. I tried to import the source code provided here and I got the
following error. I apologize if this is a simple question or already covered in other forums. I really
appreciate your guidance.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 9 of 11
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838) at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at
org.apache.catalina.core.StandardService.start(StandardService.java:519) at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at
org.apache.catalina.startup.Catalina.start(Catalina.java:581) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start
(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by:
Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest
class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean -
jar:file:/C:/JavaDevelopment/Workspace/StrutsHelloWorld/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:221) at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register
(StrutsXmlConfigurationProvider.java:101) at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer
(DefaultConfiguration.java:169) at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration
(ConfigurationManager.java:55) ... 21 more Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/fileupload/FileUploadException at java.lang.Class.getDeclaredConstructors0
(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at
java.lang.Class.getDeclaredConstructors(Unknown Source) at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:211) ... 24 more Caused by: java.lang.ClassNotFoundException:
org.apache.commons.fileupload.FileUploadException at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516) at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361) ... 28
more Jul 27, 2010 11:55:00 PM org.apache.catalina.core.StandardContext filterStart SEVERE:
Exception starting filter struts2 Unable to load configuration. - bean -
jar:file:/C:/JavaDevelopment/Workspace/StrutsHelloWorld/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:431) at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:190) at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295) at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422) at
org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115) at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838) at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4488) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at
org.apache.catalina.core.StandardService.start(StandardService.java:519) at
org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at
org.apache.catalina.startup.Catalina.start(Catalina.java:581) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at
java.lang.reflect.Method.invoke(Unknown Source) at org.apache.catalina.startup.Bootstrap.start
(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by:
Unable to load configuration. - bean -
jar:file:/C:/JavaDevelopment/Workspace/StrutsHelloWorld/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration
(ConfigurationManager.java:58) at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration
(Dispatcher.java:374) at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:418) ... 19 more
Caused by: Unable to load bean: type:org.apache.struts2.dispatcher.multipart.MultiPartRequest
class:org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest - bean -
jar:file:/C:/JavaDevelopment/Workspace/StrutsHelloWorld/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/StrutsHelloWorld/WEB
-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:47:178 at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:221) at
org.apache.struts2.config.StrutsXmlConfigurationProvider.register
(StrutsXmlConfigurationProvider.java:101) at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer
(DefaultConfiguration.java:169) at
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 10 of 11
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration
(ConfigurationManager.java:55) ... 21 more Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/fileupload/FileUploadException at java.lang.Class.getDeclaredConstructors0
(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at
java.lang.Class.getDeclaredConstructors(Unknown Source) at
com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register
(XmlConfigurationProvider.java:211) ... 24 more Caused by: java.lang.ClassNotFoundException:
org.apache.commons.fileupload.FileUploadException at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516) at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361) ... 28
more Jul 27, 2010 11:55:00 PM org.apache.catalina.core.StandardContext start SEVERE: Error
filterStart Jul 27, 2010 11:55:00 PM org.apache.catalina.core.StandardContext start SEVERE: Context
[/StrutsHelloWorld] startup failed due to previous errors
Sorry for multiple posts. I tried to reimport the project again and I'm getting differ error. I tried to keep
struts.xml in resources as well in root (StrutsHelloWorld dir itself) and I'm getting the same error as
beloe. Please help.
Jul 28, 2010 12:53:35 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based
Apache Tomcat Native library which allows optimal performance in production environments was not
found on the java.library.path: C:\Sun\Java\jre6
\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Sun/Java/jre6/bin/client;C:/Sun/Java/jre6/bin;C:/Sun/Java/jre6/lib/i386;C:\oracle\product\10.2.0
\db_1\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program
Files\CyberLink\Power2Go\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program
Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program
Files\QuickTime\QTSystem\;C:\Program Files\MySQL\MySQL Server 5.1
\bin;C:\Sun\AppServer\bin;C:\Sun\Java\jdk1.6.0_20\bin
Jul 28, 2010 12:53:35 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source'
to 'org.eclipse.jst.jee.server:StrutsHelloWorld' did not find a matching property.
Jul 28, 2010 12:53:35 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote
HTTP/1.1 on http-8080 Jul 28, 2010 12:53:35 AM org.apache.catalina.startup.Catalina load INFO:
Initialization processed in 613 ms Jul 28, 2010 12:53:35 AM
org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jul 28, 2010
12:53:35 AM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine:
Apache Tomcat/6.0.26
Jul 28, 2010 12:53:36 AM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.FilterDispatcher
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:269)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef
(ApplicationFilterConfig.java:422)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3838)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4488)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jul 28, 2010 12:53:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Jul 28, 2010 12:53:36 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/StrutsHelloWorld] startup failed due to previous errors
@Sarav Sri: I got the exact same errors that you have posted. After some trials, I was able to
overcome them by removing all the struts jar files except the 5 jars that have are needed from my
project build path.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010
Struts 2 Tutorial: Create Struts 2 Application in Eclipse | Javalobby Page 11 of 11
Remove all the others, export your project as a war file to tomcat/webapps and start the server, your
tomcat startup will be clean. If you are still facing any trouble, let us know.
I initially added all the jars from the struts-2.0.14-lib.zip, assuming that they will be needed for the
remaining struts2 tutorials (2 through 7). I guess I'll find out which jars are actually needed as I
progress through the remaining tuts.
@Viral Patel: Thank you for this tutorial, and the rest. They are very well written and explained. Teach
by Trying works very well for me, Thank you.
For Struts 2.2.1, Eclipse 3.6-jee, Tomcat 6 you need to make these small changes/additions for the
application to run. 1. Add the following jars to the WebContent/WEB-INF/lib/ folder: commons-
fileupload.jar commons-io.jar javaassist.jar (download from jboss files at sourceforge.net) 2. To make
"Serializable class without serialVersionUID" warning go away: Window - Preferences - Java -
Compiler - Errors/Warnings – Potential Programming Problems and set Serializable class without
serialVersionUID to "ignore". 3. “setPropertiesRule” warning message when starting Tomcat from
Eclipse: Double click on your tomcat server. It will open the server configuration. Under server options
check ‘Publish module contents to separate XML files’ checkbox. Restart your server. This time your
page will come without any issues. Your application should work without issues now.
Flat list - expanded Date - oldest first 30 comments per page Save settings
Select your preferred way to display the comments and click "Save settings" to activate your changes.
http://java.dzone.com/articles/struts2-tutorial-part-27 10/9/2010