• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dharamshila Khandelwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes you think it has to do with the mapping? Where's your servlet declaration? Where did you place the class file?
 
Dharamshila Khandelwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65120
91
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
struts.jar is present in WEB-INF/lib
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the error message that you've got ?
 
Dharamshila Khandelwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, "*.update" is not "*.do". That url isn't mapped to your servlet.
 
Dharamshila Khandelwal
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please tell me how should the mapping be?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic