Meaningless Drivel is fun!*
The moose likes JSP and the fly likes Getting started with JSP-Servlet using apache-tomcat-5.5.17 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Getting started with JSP-Servlet using apache-tomcat-5.5.17" Watch "Getting started with JSP-Servlet using apache-tomcat-5.5.17" New topic

Getting started with JSP-Servlet using apache-tomcat-5.5.17

Riyaz Saiyed

Joined: Aug 13, 2006
Posts: 22
Hi all,
I'm trying to run an example which display fist - a login page. Then there is a call to servlet which retrieves user name and finally displays welcome message to the user.

My directory structure..
1) Root directory : TOMCATE_INST_DIR\webapps\onJava
2) login.jsp : TOMCATE_INST_DIR\webapps\onJava\login.jsp
3) welcome.jsp : TOMCATE_INST_DIR\webapps\onJava\welcome.jsp
4) web.xml : TOMCATE_INST_DIR\webapps\onJava\WEB-INF\web.xml
5) servlet class : TOMCATE_INST_DIR\webapps\onJava\WEB-INF\clssses\com

My login.jsp include code to call servlet:
<form name="loginForm" method="post" action="servlet/com.onjava.login">
My include cole to redirect requst to welcome.jsp

I've made followin entry in TOMCATE_INST_DIR\conf\server.xml
<Context path="/onJava" docBase="onJava" debug="0" reloadable="true" />

Now when i invoke my login page : http://localhost:8080/onJava/login.jsp
i get login screen where i supposed to provide user name. once i do this,
i invoke login servlet (com.onjava.login.class), which should display welcome message (welcome.jsp)

But while invoking servlet i get following error
HTTP Status 404 - /onJava/servlet/com.onjava.login

type Status report

message /onJava/servlet/com.onjava.login

What's wrong with the configuration (Above structure works fine if i put all my code under ROOT dir).

I've followed example :

Please guide me..
[ October 10, 2006: Message edited by: Riyaz Saiyed ]
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

I think that you need to enable the ugly servlet invoker.
Open tomcat's /conf/web.xml. Look for "invoker" in this file, and uncomment the invoker servlet. Reboot Tomcat, and retry.

[My Blog]
All roads lead to JavaRanch
Riyaz Saiyed

Joined: Aug 13, 2006
Posts: 22
Ya.. Its already uncommented...
I did it when I tried my first example..
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Uncommenting the invoker servlet is a bad way to start out, in my opinion.
Can you post the contents of your web.xml file?

Also, if you want an example of a proper webapp, you can download any of the war files from my site and drop them in your webapps directory.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Riyaz Saiyed

Joined: Aug 13, 2006
Posts: 22
Content of web.xml : TOMCATE_INST_DIR\webapps\onJava\WEB-INF\web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns=""

<!-- The onJava ExampleServlet -->
I agree. Here's the link:
subject: Getting started with JSP-Servlet using apache-tomcat-5.5.17
Similar Threads
how to create our own wbapplication
Web Application Deployment
Tomcat Under Apache in Windows
to create login.jsp
Pulling my hair out over Tomcat servlets