jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes TOMCAT Configuration Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "TOMCAT Configuration Question" Watch "TOMCAT Configuration Question" New topic

TOMCAT Configuration Question

zheng yu

Joined: Apr 25, 2001
Posts: 28
I have installed TOMCAT on a linux server successfully , that means i can see the things under examples directory .
( All the jsp/servlet samples under example directory is OK )
But when i make a new directory named myproj under webapp/ directory and copy some servlet samples to myproj .server always tell me that "the servlet was not found ", when i change the servlet to jsp , it works properly .( i think this means myproj context has been recognized by TOMCAT )
I am really puzzled . can someone tell me how to solve this problem ?
(when i copy these sample servlets to TOM_CAT_HOME/webapp/examples directory , it works perfectly )
Environ :
Turbolinux / Oracle8i /Tomcat3.2.1/JDK1.2.2
folder tree is show as follow :
Does someone has created your own app directory under TOMCAT_HOME/webapp directory( like TOMCAT_HOME/webapp/examples) , that can handle jsp/jservlet requests properly , and can show the directory structure in browser( If u input the web address like http://mysite/examples ) ? if u did it , please tell me step by step . i am not as clever as u

Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
If you have /webapps/myproj, you need a WEB-INF directory under that with the following:
and in web.xml you should define your servlet:
then restart Tomcat and try http://localhost:8080/myproj/MyServlet.
Look at the WEB-INF directory in the example webapp and use that as a model. It has a complete web.xml that you can adapt.
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets

Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
zheng yu

Joined: Apr 25, 2001
Posts: 28
Thanx for your reply
But before i posted this question , i had checked it .
(i have read TOMCAT's online document serveral times )
first , i declare i have the same directory srtucture
like examples , and i do place my servlet class under
TOMCAT_HOME/webapp/myproj/WEB-INF/ .
next i copyed the Web.xml file from examples directory,
and just appended one servlet tag ( <servlet> </servlet> pair)
what i dont know is the contents of web.xml and how to write it
from scratch even after i have read sun's servlet specification
but anyway i will check it again

Need your help
zheng yu

Joined: Apr 25, 2001
Posts: 28
Let me describe my situation
First , Some one setup an apache server , and set its port to 8080
then I installed TOMCAT . and some one comment the following Element :
< Connector className="org.apache.tomcat.service.PoolTcpConnector">
< Parameter Name="handler"
<Parameter name="port" value="8080"/>
if i uncomment this <Connector> </Connector> pair , TOMCAT's Startup failed because of BindException , so i think that must be a port confliction . after i changed the port to 8011 , and input some url
in my browser like : http://site address:8011/myproj/servlet/CurrentTime, it works( myproj is my application , and CurrentTime is a simple servlet sample class )
so i think what u all tell me is all right . The reason is my environment , port confliction to be exactly . What's your explanation ?
can't apache and Tomcat share the same port ?

Thanx again
Have you checked out Aspose?
subject: TOMCAT Configuration Question
It's not a secret anymore!