• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running self made Servlets on tomcat

 
navodit
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am glad too.
regds
maha anna
 
Mark Lau
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Maha Anna,
What a surprise!. You back in ranch. Well good to see you around. Welcome back
Nasser
 
Marilyn de Queiroz
Sheriff
Posts: 9066
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the date, December 30, 2000, not 2001.
 
Nasser Aboobaker
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh No,
I am duped.
Well thanks for letting me know.
By the way.. Where is Maha Anna!!
Nasser
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic