File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes just a simple question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "just a simple question" Watch "just a simple question" New topic

just a simple question

bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
hey folks,
i`m using tomcat 4.0 j2sdk1.4.0 and suse 7.3.i have created a new directory under /root/tomcat/webapps(=TOMCAT_HOME) that looks like this: /bernd/WEB-INF/classes. i`ve done this, because i want to seperate my servlets from the others.
when i wanna run a servlet by calling http://localhost/bernd/servlet/servletname it won`t work, although when i call it from the old place http://blabla/examples/servlet/servletname it`s still going.
the old path is TOMCAT_HOME/examples/WEB-INF/classes.
i know, one solution is: let the servlet in the old place, but i want to understand the problem.
could anybody help me please
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Because u have configured ur tomcat to understand whats under bernd directory
for this u need check conf/server.xml and see how to add new context
for example like this.
<Context path="/bernd"
reloadable="true" >
after this u try http://local/bernd/servlet/servletname

Spritle Software Blogs
bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
Hey Balaji,
i`ve changed the server.xml file, also i`ve configured the web.xml file. it won`t work.
i`ve tried a few, copyed the files into different directory`s and changed the server.xml, nothing.
then i read in an article from Kishore Dandu on this page from 5.07 that i can run a servlet by calling it like this: http://localhost/servlet/servletname.
i tried this, it doesn`t work even with old proofed servlets.
i keep on wondering
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
Balaji's suggestion ought to have worked... Just asking, but did you restart Tomcat after changing server.xml?
bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
hey anthony,
oh yes i`ve restarted tomcat every time i changed server.xml.i guess it`s a little mistake, but i cann`t see it.
i have changed my server.xml just like Balaji wrote.
then i tried some different ways for example, i`ve changed docBase="webapps/bernd" or crossContext="true", always the same error (http status 404).
my directory tree is:
i have declared the servlet in the web.xml.
what have i done wrong?
bernd pier
Ranch Hand

Joined: Jun 21, 2002
Posts: 30
i`ve found my mistake. i was simply to stupid, but now it works.
what a wonderful day
I agree. Here's the link:
subject: just a simple question
jQuery in Action, 3rd edition