aspose file tools
The moose likes Tomcat and the fly likes Servlet mapping not working after upgrading to Tomcat  6 from Tomcat 5 Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Reply Bookmark "Servlet mapping not working after upgrading to Tomcat  6 from Tomcat 5" Watch "Servlet mapping not working after upgrading to Tomcat  6 from Tomcat 5" New topic
Author

Servlet mapping not working after upgrading to Tomcat 6 from Tomcat 5

Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
Hi,

I have the following servlet mapping in webapps/<webapp>/WEB-INF/web.xml

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

This mapping worked fine with Tomcat 5, but when I am running the application with the same mapping, it is not able to load the servlet saying that the requested servlet not found.

Can anyone please help?

Thanks,
DS.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

What makes you think it has to do with the mapping? Where's your servlet declaration? Where did you place the class file?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
Hi,

I deployed the same war file as was deployed in Tomcat 5.
The classes are under WEB-INF/classes.
Following is the web.ml that I am using:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>

<description>HSN Uom</description>
<display-name>HSN Uom</display-name>

<servlet>
<servlet-name>banking</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>

<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>banking</servlet-name>
<url-pattern>/action/*</url-pattern>
</servlet-mapping>

<!-- Standard Action Servlet Mapping -->
<!--
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
-->

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list><welcome-file>login.jsp</welcome-file></welcome-file-list>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

</web-app>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56224
    
  13

org.apache.struts.action.ActionServlet is under classes? I think not.

Did you forget to include the struts jar file in WEB-INF/lib?

Any information in the logs during startup?
Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
struts.jar is present in WEB-INF/lib
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

Can you post the error message that you've got ?


[My Blog]
All roads lead to JavaRanch
Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
From the URL http://wmsweb1.xxx.net:9501/uom/uom.do, when I click on 'Save' it invokes http://wmsweb1.hsn.net:9501/uom/servlet/uom.update,
the message that I get is:


HTTP Status 404 - /uom/servlet/uom.update

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

type Status report

message /uom/servlet/uom.update

description The requested resource (/uom/servlet/uom.update) is not available.


Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

Well, "*.update" is not "*.do". That url isn't mapped to your servlet.
Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
Can you please tell me how should the mapping be?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

Dharamshila Khandelwal wrote:Can you please tell me how should the mapping be?

Which servlet is it supposed to be mapped to ?
Dharamshila Khandelwal
Greenhorn

Joined: Mar 08, 2011
Posts: 6
My current jsp URL is
http://wmsweb1.xxx.net:9501/uom/uom.do?ppid=100000&var1=*&var2=*&var3=*&submit=Find

When I click on 'Save Changes'
It takes me to URL http://wmsweb1.hsn.net:9501/uom/servlet/uom.update

Now I can't tell you what should the mapping look like. But the thing is, that the same configuration works on Tomcat 5, but doesn't work on Tomcat 6.

I added following new classes to $CATALINA_HOME/lib yesterday:
servlets-common.jar
servlets-default.jar
servlets-invoker.jar
struts.jar

servlet-api.jar was already present

I already have structs.jar in <webapp>/WEB-INF/lib.

Is there any other class that I might be missing? Also is there any version of these jar file which is supported by Tomcat 6?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12271
    
    1
Exactly what is generating the HTML page that you are seeing when the following happens?

When I click on 'Save Changes'
It takes me to URL http://wmsweb1.hsn.net:9501/uom/servlet/uom.update


If that is your application, where did that URL come from?

Bill

Java Resources at www.wbrogden.com
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14672
    
  11

http://wmsweb1.hsn.net:9501/uom/servlet/uom.update

Wait a second... The /servlet/ part looks like an InvokerServlet URL. Check this FAQ. It must be off. Try to turn it on.
 
jQuery in Action, 2nd edition
 
subject: Servlet mapping not working after upgrading to Tomcat 6 from Tomcat 5
 
Similar Threads
Spring 3 not calling .html and servlet is not available
Servlet mapping problem ...
HTTP error 404 when mapping for the invoker servlet is uncommented
Servlet Error when deploy with tomcat
The requested resource is not available