wood burning stoves 2.0*
The moose likes Struts and the fly likes Unable to deploy the Struts 2 application in tomcat 5.0.27 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unable to deploy the Struts 2 application in tomcat 5.0.27" Watch "Unable to deploy the Struts 2 application in tomcat 5.0.27" New topic
Author

Unable to deploy the Struts 2 application in tomcat 5.0.27

K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
Hi,
I am working on an appication, which uses struts 2 framework. After creating the war file, when deployed in tomcathome\webapps dir, and I start the server, I get the following error(below). Not sure where exactly the error is either with struts configuration or tomcat configuration.

Here is my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<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>/jsp/login.jsp</welcome-file>
</welcome-file-list>
</web-app>

The error I get when tomcat starts(I get the message context startup failed):

INFO: Starting Servlet Engine: Apache Tomcat/6.0.10
Apr 30, 2008 4:14:39 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive FP.war
Apr 30, 2008 4:14:40 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-default.xml]
Apr 30, 2008 4:14:40 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Apr 30, 2008 4:14:40 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/FP] startup failed due to previous errors
Apr 30, 2008 4:14:40 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive struts2-blank-2.0.11.war
Apr 30, 2008 4:14:41 PM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-default.xml]
Apr 30, 2008 4:14:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Apr 30, 2008 4:14:41 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/struts2-blank-2.0.11] startup failed due to previous errors
Apr 30, 2008 4:14:43 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 30, 2008 4:14:43 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 30, 2008 4:14:43 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/31 config=null
Apr 30, 2008 4:14:43 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 4125 ms


Any help on this will be highly appreciated.

Regards,
Kiran.
[ April 30, 2008: Message edited by: K Kiran Kumar ]
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
Well, I don't really know, but I realized that you are using servlets 2.5. This is not compatible with tomcat 5.x, but compatible with tomcat 6.x. Either upgrade tomcat, or use servlets 2.4. Maybe this is the problem. Not sure of course


Visit my blog: http://jnassef.blogspot.com/
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It looks like he is using Tomcat 6 (although the thread title is misleading)
-> Starting Servlet Engine: Apache Tomcat/6.0.10

What is there in struts-default.xml ?


[My Blog]
All roads lead to JavaRanch
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
Hi Nassef,
I did try with the following (I mean version 2.4 and several other configurations):
<web-app 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">
----
---
</web-app>

I tried in both the versions i.e., in tomcat 5.0.27 and tomcat 6.0.10

Hi Christophe Verre,
I am also confused where is the struts-default.xml file. Why is it parsing it.
If at all it should be parsing struts.xml but not struts-default.xml.

I am using eclipse 3.0. I am creating the war file through the eclipse IDE. No clue how to solve it.....


There is one related thread related to my issue. I tried it but no result....
http://forum.java.sun.com/thread.jspa?threadID=542044&messageID=4406886

Regards,
Kiran.
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
According to the struts 2 guide, struts-default.xml is
A base configuration file named struts-default.xml is included in the struts2.jar file. This file is automatically included into struts.xml file to provide the standard configuration settings without having to copy them.

Is struts.xml in /WEB-INF/classes? if so, can you paste the contents to see if there is a problem in it?
chad michael davis
Author
Greenhorn

Joined: Mar 01, 2006
Posts: 27
struts-default.xml is the built in configuration file that defines all of the built-in components that come with Struts 2, out of the box. I.e., this declares things like the default stack of interceptors.

The line you see is just the log statement of the Struts 2 filter running its config set up. I doubt this file is the cause of the problem . . .


Chad Davis<br />Co-author of Struts 2 in Action
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
My struts.xml file is in /WEB-INF/classes folder itself. I had found the file struts-default.xml. It is in struts2-core-2.0.11.1.jar.

I tried deploying the blank war file located at http://struts.apache.org/download.cgi, I am getting the following:

May 1, 2008 11:49:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive struts2-blank-2.0.11.war
May 1, 2008 11:49:07 AM com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
INFO: Parsing configuration file [struts-default.xml]
May 1, 2008 11:49:07 AM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
May 1, 2008 11:49:07 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/struts2-blank-2.0.11] startup failed due to previous errors

I guess there should be a minute configuration to be done at server side only or something to do with struts-default.xml file. Any help will be highly appreciated.

Regards,
Kiran.
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Could you try deploying the struts blank WAR or the examples WAR to test if it works? If they could start up, it is probably something wrong with your WAR file.

You could then try to migrate your codes into the Struts blank WAR and try again.


SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Maybe you are missing some libraries. Make sure you have these listed here.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Ok, I had a similar problem today, and it came from one of my xml files not being well-formed. The problem obviously happens when the struts filter starts, but I was left with "Error filterStart" only... I thought that the filter must be logging errors somewhere, so I tried to use a SimpleLog :
WEB-INF/classes/commons-logging.properties

WEB-INF/classes/simplelog.properties


I restarted the container, and the problem details were finally printed out in one of the container's log. So, maybe you could try to do the same, and see what gets printed out. You'll need the commons-logging library in your lib directory.
K Kiran Kumar
Ranch Hand

Joined: Jan 04, 2006
Posts: 109
Hi Christophe Verre,

Finally with the help of logs, I fixed the issue.

A small error here.... I have the struts2-core-2.0.11.jar in my war file (FP) at FP/WEB-INF/lib/. Also there is one struts2-core-2.0.11.jar file present in tomcat/common/lib.
So I have deleted the struts2-core-2.0.11.jar file in tomcat/common/lib dir
since as per my understanding, it is trying to load this jar once again and failing to do so because it has already loaded it.

I have done the settings for logs that you suggested. Here is what it gives me in the logs:
------------------
2008-05-02 13:59:01 StandardContext[/FP]Exception starting filter struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/Tomcat%205.27/jakarta-tomcat-5.0.27/webapps/FP/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:30:72
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
at
.
.
.
org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

Caused by: Bean type class com.opensymphony.xwork2.ObjectFactory with the name xwork has already been loaded by bean - jar:file D:/Tomcat 5.27/jakarta-tomcat-5.0.27/common/lib/struts2-core-2.0.11.1.jar!/struts-default.xml:30:72 - bean - jar:file:/D:/Tomcat%205.27/jakarta-tomcat-5.0.27/webapps/FP/WEB-INF/lib/struts2-core-2.0.11.jar!/struts-default.xml:30:72at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:193)
... 34 more
-------------------

Thanks a lot Christophe and others for assisting me.

Regards,
Kiran.
[ May 02, 2008: Message edited by: K Kiran Kumar ]
pritam sabnis
Greenhorn

Joined: Dec 27, 2007
Posts: 6
Hi,
I was facing the same problem yesterday.
I just made the 'devalopmentmode=false' in struts.xml and it worked


Thanks and regards,

Pritam Sabnis
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to deploy the Struts 2 application in tomcat 5.0.27
 
Similar Threads
Struts2 config error
Error in FilterStart Struts 2 web app
working with hashmap using struts2
Error in deploy blank.war
Struts2 with JDK1.4.2_19 & Tomcat 5.0.28