Tutorial: Create Struts 2 Application in Eclipse

      

struts2-hello-world
Welcome to the Part 2 of 7-part series where we will explore the world of Struts 2 Framework. In previous article we went through the basics of Struts2, its Architecture diagram, the request processing lifecycle and a brief comparison of Struts1 and Struts2. If you have not gone through the previous article, I highly recommend you to do that before starting hands-on today.

Things We Need

Before we starts with our first Hello World Struts 2 Example, we will need few tools.

  1. JDK 1.5 above (download)
  2. Tomcat 5.x above or any other container (Glassfish, JBoss, Websphere, Weblogic etc) (download)
  3. Eclipse 3.2.x above (download)
  4. Apache Struts2 JAR files:(download). Following are the list of JAR files required for this application.
    • commons-logging-1.0.4.jar
    • freemarker-2.3.8.jar
    • ognl-2.6.11.jar
    • struts2-core-2.0.12.jar
    • xwork-2.0.6.jar

    Note that depending on the current version of Struts2, the version number of above jar files may change.

Our Goal

Our goal is to create a basic Struts2 application with a Login page. User will enter login credential and if authenticated successfully she will be redirected to a Welcome page which will display message ” Howdy, <username>…!“. If user is not authenticated, she will be redirected back to the login page.
struts2-application-login-page

Getting Started

Let us start with our first Struts2 based application.
Open Eclipse and goto File -> New -> Project and select Dynamic Web Project in the New Project wizard screen.
Dynamic Web Project in Eclipse

After selecting Dynamic Web Project, press Next.
Eclipse Struts2 Project

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.

Once the project is created, you can see its structure in Project Explorer.
Eclipse Project Explorer: Struts2 Example

Now copy all the required JAR files in WebContent -> WEB-INF -> lib folder. Create this folder if it does not exists.
struts2-webinf-jars

Mapping Struts2 in WEB.xml

As discussed in the previous article (Introduction to Struts2), the entry point of Struts2 application will be the Filter define in deployment descriptor (web.xml). Hence we will define an entry of org.apache.struts2.dispatcher.FilterDispatcher class in web.xml.

Open web.xml file which is under WEB-INF folder and copy paste following code.

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" version="2.4"
	xmlns="http://java.sun.com/xml/ns/j2ee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

	<display-name>Struts2 Application</display-name>
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>
			org.apache.struts2.dispatcher.FilterDispatcher
		</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<welcome-file-list>
		<welcome-file>Login.jsp</welcome-file>
	</welcome-file-list>

</web-app>

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.

The Action Class

We will need an Action class that will authenticate our user and holds the value for username and password. For this we will create a package net.viralpatel.struts2 in the source folder. This package will contain the action file.
struts2-source-package
Create a class called LoginAction in net.viralpatel.struts2 package with following content.

package net.viralpatel.struts2;

public class LoginAction {
	private String username;
	private String password;

	public String execute() {

		if (this.username.equals("admin")
				&& this.password.equals("admin123")) {
			return "success";
		} else {
			return "error";
		}
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}

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.
struts2-resource-folder
Specify folder name resources and press Finish.

Create a file ApplicationResources.properties under resources folder.
struts-2-application-resources-properties
Copy following content in ApplicationResources.properties.

label.username= Username
label.password= Password
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.

Login.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Struts 2 - Login Application | ViralPatel.net</title>
</head>

<body>
<h2>Struts 2 - Login Application</h2>
<s:actionerror />
<s:form action="login.action" method="post">
	<s:textfield name="username" key="label.username" size="20" />
	<s:password name="password" key="label.password" size="20" />
	<s:submit method="execute" key="label.login" align="center" />
</s:form>
</body>
</html>

Welcome.jsp

<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Welcome</title>
</head>

<body>
	<h2>Howdy, <s:property value="username" />...!</h2>
</body>
</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.

The struts.xml file

Struts2 reads the configuration and class definition from an xml file called struts.xml. This file is loaded from the classpath of the project. We will define struts.xml file in the resources folder. Create file struts.xml in resources folder.
struts2-struts-xml
Copy following content into struts.xml.

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
	<constant name="struts.enable.DynamicMethodInvocation"
		value="false" />
	<constant name="struts.devMode" value="false" />
	<constant name="struts.custom.i18n.resources"
		value="ApplicationResources" />

	<package name="default" extends="struts-default" namespace="/">
		<action name="login"
			class="net.viralpatel.struts2.LoginAction">
			<result name="success">Welcome.jsp</result>
			<result name="error">Login.jsp</result>
		</action>
	</package>
</struts>

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.

	<action name="login" method="authenticate"
		class="net.viralpatel.struts2.LoginAction">

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.
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:

label.username= Username
label.password= Password
label.login= Login
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:

package net.viralpatel.struts2;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {
	private String username;
	private String password;

	public String execute() {

		if (this.username.equals("admin")
				&& this.password.equals("admin123")) {
			return "success";
		} else {
			addActionError(getText("error.login"));
			return "error";
		}
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}

And that’s it. Our first Hello World Struts2 Application is now ready.

That’s All Folks

Execute the application in Eclipse and run it in your favorite browser.
Login page
struts2-application-login-page

Welcome page
struts2-welcome-page

Login page with error
struts2-login-page-error

Download Source Code

Click here to download Source Code without JAR files (9KB).

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.


Facebook  Twitter      Stumbleupon  Delicious
  

27 Comments on “Tutorial: Create Struts 2 Application in Eclipse”

  • Gaurav - PHP/MySql programmer INDIA wrote on 23 December, 2009, 18:44

    Nice work dude …. keep it up… :) .. write some good post regarding PHP-MySQl also

  • Viral Patel wrote on 26 December, 2009, 0:49

    Hi Gaurav, Thanks a lot for comment. I will sure try to write something on that too.

  • atif wrote on 29 December, 2009, 11:31

    yes VIRal very good work nice approach followed……………..

  • atif wrote on 29 December, 2009, 11:43

    still there is one problem viral when i am running the application it is showing http 404 error
    please reply dear

  • Viral Patel wrote on 29 December, 2009, 16:14

    @atif, have you specified welcome file in your web.xml? Please specify Login.jsp as welcome file in web.xml.

  • atif wrote on 30 December, 2009, 14:45

    ya i have given the welcome file as login.jsp and the problem has been sorted out when i used tomcat 6.X
    thanks for the reply

  • jawahar wrote on 5 January, 2010, 13:54

    hi i implemented all d codes given above but when i start the server it gives
    HTTP Status 404 –

    ——————————————————————————–

    type Status report

    message

    description The requested resource () is not available.

  • Viral Patel wrote on 5 January, 2010, 14:03

    @jawahar – Can you check if following code is present in your web.xml file.

    <welcome-file-list>
            <welcome-file>Login.jsp</welcome-file>
    </welcome-file-list>
    
  • jawahar wrote on 5 January, 2010, 17:54

    ya its there viral and don know why its not coming……….

  • jawahar wrote on 5 January, 2010, 17:59

    ya i checked its there but its not coming yar……

  • jawahar wrote on 5 January, 2010, 18:08

    ya viral its there but its not coming………..

  • Viral Patel wrote on 5 January, 2010, 18:10

    @jawahar – I will suggest you to check the source code properly. Download the source code of above tutorial and try to run it and see if everything is working well.

  • jawahar wrote on 6 January, 2010, 10:58

    i recreated the project again it run successfully ………..i think some were went wrong………great work yarrrrrr………keep…….up the tempo………..

  • jawahar wrote on 6 January, 2010, 11:11

    i have one doubt viral the following code in Login.jsp ………
    y we put login.action …..y i m asking this ? means in struts.xml we mentioned name as “login” only thats y.

  • Ali wrote on 14 January, 2010, 14:16

    Hey Patel

    I am also getting the resource not found error. I have made the project again & downloaded your code…what could be the other reason???

    Thanks

  • atif wrote on 16 January, 2010, 10:05

    hi patel
    as i am new to struts give some more stuffs on that ur starter helps me a lot…….

    thanks

  • Sadia Butt wrote on 17 January, 2010, 11:06

    Hi Viral

    I downloaded the project & trying to run but I am having the same error which jawahar & ali were having. How can I remove that error & run the project successfully?

    Thanks

    Sadia

  • Viral Patel wrote on 17 January, 2010, 14:37

    @Sadia – Check the server logs when the server starts. There must be some exception coming in there. Once reason I can think of is that some required jar file is missing or due to version difference there must be a ClassNotFound exception.

  • Akalanka wrote on 19 January, 2010, 17:10

    please add the commons-fileupload-1.2.1.jar file to the lib folder and try again.

  • Raj wrote on 2 February, 2010, 1:56

    Add commons-io and commons-fileupload jars

  • mizo wrote on 12 February, 2010, 2:29

    I’m getting a parsing error in web.xml :

    Struts2 Application

    struts2

    org.apache.struts2.dispatcher.FilterDispatcher

    struts2
    /*

    Login.jsp

    The exception is :

    SEVERE: End event threw exception
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:928)
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:193)
    at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1138)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1072)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at 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:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts
    at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2275)
    … 35 more
    Feb 11, 2010 4:07:40 PM org.apache.catalina.startup.ContextConfig applicationWebConfig
    SEVERE: Parse error in application web.xml file at jndi:/localhost/StrutsWebApp/WEB-INF/web.xml
    java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2806)
    at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:2832)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:633)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1241)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1685)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
    at org.apache.catalina.startup.ContextConfig.applicationWebConfig(ContextConfig.java:365)
    at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1072)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4377)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at 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:593)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
    Caused by: java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts
    at org.apache.catalina.core.StandardContext.addFilterMap(StandardContext.java:2275)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:928)
    at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:193)
    at org.apache.tomcat.util.digester.Rule.end(Rule.java:229)
    at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:1138)
    … 27 more

    It gives a Parse error in application web.xml file at jndi:/localhost/StrutsWebApp/WEB-INF/web.xml
    java.lang.IllegalArgumentException: Filter mapping specifies an unknown filter name struts2

    Thanks,
    mizo

  • Anna wrote on 5 March, 2010, 1:39

    Hi
    I just used your source file to recreate the project. But whatever I do I am getting some errors like,
    SEVERE: Dispatcher initialization failed and
    SEVERE: Exception starting filter struts2
    I have used these jars from strtus 2.1.8.1 zip
    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-core-2.1.8.1.jar
    xwork-2.0.7.jar

    Can someone help me out from this.

  • Anna wrote on 5 March, 2010, 2:08

    Hi,
    I am using eclipse 3.4, and struts2.1.8.1 verison , does difference in the versions of jar files cause some problems.

    Looking forward to the replies.

    Thanks in advance.

  • riddhi karnik wrote on 5 March, 2010, 14:57

    hi viral
    can u please help me out
    initially my struts2 project was running fine but now such an error comes up in eclipse:
    Classpath entry E:/My_Folders/MyProj/eclipse/HelloWorld/WebContent/WEB-INF/lib/commons-logging-1.0.4.jar will not be exported or published. Runtime ClassNotFoundExceptions may result.

    what is the reason?

  • Jagadish wrote on 6 March, 2010, 14:57

    Hi viral,

    Thanks for your application.
    I am able to run the app. When i enter username and password.

    in the loginaction class you have mention this.username and this.password.

    actually those variables are null and I am geeting a nullpoint exception.

    Actually i have worked on spring MVC.
    there we use UIBean to get the variables from jsp page. But I dont know how you are able to get here.

    Please explain ASAP.

    regards,

    Jagadish

  • digant wrote on 8 March, 2010, 9:52

    Hi Viral,
    does it matter what lib package of struts2 are you importing to this project ? I mean theoratically the latest version of struts2 – lib should work if I import. But as you mentioned I am getting error log saying – no class found filterdispatcher. I am sure this is due to version mismatch of jar files of struts2., But logically the latest version should be good right ?

  • Vinayagam wrote on 12 March, 2010, 11:08

    Hi Viral,

    I copied u r code and tried i got 404 exception. Then i tried by downloading the source code what u have given. Then also I got 404 exception.

    This is the log what i got, can u please guess whats the problem i made.

    Mar 12, 2010 11:32:48 AM org.apache.catalina.core.AprLifecycleListener lifecycle
    Event
    INFO: The Apache Portable Runtime which allows optimal performance in production
    environments was not found on the java.library.path: D:\Tomcat 5.5\bin;.;C:\WIN
    DOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
    ;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\Common Files\Telec
    a Shared;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Mi
    crosoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools
    \binn\
    Mar 12, 2010 11:32:48 AM org.apache.coyote.http11.Http11BaseProtocol init
    INFO: Initializing Coyote HTTP/1.1 on http-8080
    Mar 12, 2010 11:32:48 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 531 ms
    Mar 12, 2010 11:32:48 AM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    Mar 12, 2010 11:32:48 AM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/5.5.12
    Mar 12, 2010 11:32:48 AM org.apache.catalina.core.StandardHost start
    INFO: XML validation disabled
    Mar 12, 2010 11:32:49 AM com.opensymphony.xwork2.util.logging.commons.CommonsLog
    ger info
    INFO: Parsing configuration file [struts-default.xml]
    Mar 12, 2010 11:32:49 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error filterStart
    Mar 12, 2010 11:32:49 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/helloworld] startup failed due to previous errors
    Mar 12, 2010 11:32:49 AM org.apache.coyote.http11.Http11BaseProtocol start
    INFO: Starting Coyote HTTP/1.1 on http-8080
    Mar 12, 2010 11:32:49 AM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    Mar 12, 2010 11:32:49 AM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/15 config=null
    Mar 12, 2010 11:32:49 AM org.apache.catalina.storeconfig.StoreLoader load
    INFO: Find registry server-registry.xml at classpath resource
    Mar 12, 2010 11:32:49 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 1437 ms
    Mar 12, 2010 11:33:22 AM com.opensymphony.xwork2.util.logging.commons.CommonsLog
    ger info
    INFO: Parsing configuration file [struts-default.xml]
    Mar 12, 2010 11:33:23 AM org.apache.catalina.core.StandardContext start
    SEVERE: Error filterStart
    Mar 12, 2010 11:33:23 AM org.apache.catalina.core.StandardContext start
    SEVERE: Context [/helloworld] startup failed due to previous errors

    Regards,
    Vinayagam

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

Copyright © 2010 ViralPatel.net. All rights reserved.