• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tom CAT help

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
Am new bee to this space.I am having difficulty in running a simple servlet on Tomcat 4.1.The following are my directory Structures.
TOMCAT_HOME = D:/Program Files/Apache Group/Tomcat4.1
My html fine index.html is in %TOMCAT_HOME%/webapps/greetings
My GreetingServlet.class is in %TOMCAT_HOME%/webapps/WEB-INF/classes
I am calling the GreetingServlet from index.html as
ACTION="/greetings/servlet/GreetingServlet"
My web.xml looks like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<!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>
<servlet>
<!-- Servlet Alias -->
<servlet-name>Registration</servlet-name>
<!-- fully qualified servlet class -->
<servlet-class>GreetingServlet</servlet-class>
</servlet>

</web-app>
When i run the index.html and try to call the servlet am getting
404 /greetings/servlet/GreetingServlet not found.

Can anyone tell me what i am missing here??.Is there any other place where i need to register my servlet??.
This code exercise is taken from Profession Java Server Programming from Wrox Publications.
Thanks in advance,
Ramnath
 
Ranch Hand
Posts: 250
Python Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need to add a servlet mapping in deployment descriptor of your web-application (web.xml), something like this:

Did it help?
[ July 29, 2003: Message edited by: Debashish Chakrabarty ]
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving to the Tomcat forum.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ACTION="/greetings/servlet/GreetingServlet"


This form of addressing (using /servlet/) requires the invoker servlet - this has to be THE most common problem with Tomcat 4 - look around some of the recent posts for a discussion.
You really should put all servlet and helper classes into a package - it will save you much grief.
Bill
[ July 29, 2003: Message edited by: William Brogden ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic