aspose file tools*
The moose likes Servlets and the fly likes Running self made Servlets on tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Running self made Servlets on tomcat" Watch "Running self made Servlets on tomcat" New topic
Author

Running self made Servlets on tomcat

navodit
Greenhorn

Joined: Dec 03, 2000
Posts: 7
Hi all

First of all my tomcat is running very fine, I am able to run the servlets given as example in my tomcat server at http port 8080.
But I am facing one problem that how can I run the servlets made by me ???
where should I place it in the tomcat directory i.e. html file and class file of servlet should be addressed with what thing http://localhost:8080/examples/servlets/***.html(is it right)
Plese guide me.

NK GARG
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Assume MISApp is your servletContext(Web appln ROOT) name.

regds
maha anna
[This message has been edited by maha anna (edited December 25, 2000).]
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Hi Navodit,
Please re-register with 'firstName lastName' format. Java ranch is trying to adopt a naming policy as described in www.javaranch.com/name.jsp . Thanks for your understanding.
regds
maha anna
Tejovikas Suravajjala
Greenhorn

Joined: Dec 21, 2000
Posts: 4
It is a lot easier to use the batch file that is in the sample application of tomcat. Change the XML file to register your servlet and run the batch file. You can modify the batch for the directories to be created under webapps or copy them over there if u are lazy like me.
Best of luck.
navodit
Greenhorn

Joined: Dec 03, 2000
Posts: 7
Dear MahaAnna
I am tring simple servlet having one class file and on html file
And as u said I made
C:\tomcat\webapps\MISApp\WEB-INF\classes\serv1.class
above directories and put my servlet class file named serv1.class
in abobe directory
and used the URL http://localhost:8080/misapp/serv1 But my server
reported error:
Error: 404
Location: /misapp/serv1
File Not Found
/misapp/serv1
So what should I do
Rest as u said i am changing my regd name.
Thanx for reply,
Navodit
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Navodit,
I am really sorry about a typo in my previous post. We have to put /servlet in our url. There is another way to make alias. I will explain that later. But for now you please type the url as
[I also edit my previous post.]
http://localhost:8080/misapp/servlet/serv1
Also don't forget to change your name as 'firstName lastName' foramt. Just re-register yourself.
regds
maha anna
navodit garg
Greenhorn

Joined: Dec 26, 2000
Posts: 4
Res Madam,
I have tried out the same URL , even then I get
Error: 404
Location: /misapp/servlet/
File Not Found
/misapp/servlet/
I am running TOMCAT server through C:\tomcat\bin\startup.bat
and then as u said I put myservlet in Directory
C:\tomcat\webapps\MISApp\WEB-INF\classes\serv1.class
and my URL is http://localhost:8080/misapp/servlet/serv1
But staill same reply
Error: 404
Location: /misapp/servlet/serv1
File Not Found
/misapp/servlet/serv1
Navodit Garg:O
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
Navodit,
Thanks for re-registering. The URL is case sensitive in Java. Did you try with exact case. It could be
http://localhost:8080/MISApp/servlet/serv1
Give it a try and let us know.
regds
maha anna
navodit garg
Greenhorn

Joined: Dec 26, 2000
Posts: 4
Ms Maha Anna
Thanking u very much indeed, initially I had lost patiance that it wont work, but ur coordination has really made me successful in running tomcat
Expecting same coopearation in future
Thanxs a lot
Navodit Garg
maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
I am glad too.
regds
maha anna
Mark Lau
Ranch Hand

Joined: Dec 15, 2001
Posts: 120
I was searching this forum about how to register a servlet with tomcat 4.0.1. Did not get any. So can you guys help me out?
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
This is the new "standard"
http://javaboutique.internet.com/tutorials/Tomcat/
point 5
[ January 13, 2002: Message edited by: Axel Janssen ]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

The method used in this post should really not be used for any new developments.

All servlets should be run under a web application, and this is spelled out in the servlet specification.

But just look at the webapps directory. Take the example folder and look at it's web.xml file under WEB-INF.

This is the sort of thing you need to do to 'register' a servlet for use in Tomcat. The 'lazier' way of doing it using the built-in 'servlet' context is not really recommended.
Mark Lau
Ranch Hand

Joined: Dec 15, 2001
Posts: 120
Quote: The 'lazier' way of doing it using the built-in 'servlet' context is not really recommended.
Can you further explain the 'lazier' way of doing it using built-in 'servlet' context? Thanks a lot.
Nasser Aboobaker
Ranch Hand

Joined: Dec 06, 2000
Posts: 104
Hello Maha Anna,
What a surprise!. You back in ranch. Well good to see you around. Welcome back
Nasser
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Check the date, December 30, 2000, not 2001.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Nasser Aboobaker
Ranch Hand

Joined: Dec 06, 2000
Posts: 104
Oh No,
I am duped.
Well thanks for letting me know.
By the way.. Where is Maha Anna!!
Nasser
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Running self made Servlets on tomcat