File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Getting servlet to work with TOMCAT4.1.18 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Getting servlet to work with TOMCAT4.1.18" Watch "Getting servlet to work with TOMCAT4.1.18" New topic
Author

Getting servlet to work with TOMCAT4.1.18

tradester amagio
Greenhorn

Joined: Feb 10, 2003
Posts: 6
Hi, Ive been trying to get a servlet working on tomcat 4.1.18. (basically trying desperatley to upgrade from 3.2.1 to see if any perfomrnace gain)
My problem is that tomcat will now startup itself and display jsp pages and htm pages in the examples folder.
I need to add another folder.
In tomcat 3.2.1, I edited the server.xml to include an additional context like:
<!--derrick added this line
<Context
path="/intranettv"
docBase="D:\intranettv\admin\public_site"
debug="0"
reloadable="true"
crossContext="false">
</Context>-->
Then all i had to do was go to localhost:8888/intranettv/+class¶ms
When i try to add this context to tomcat 4.1.18 server.xml it goes a bit mental and complains about parser errors in web.xml
Do i also have to change web.xml somewhere else??
What do I have to do from this point to get the tomcat to recognise where the servlet is stored and where to put a pointer to the initial servlet class!!
Help please!
ps the old Web.inf for tomcat 3.2.1 looked like this. Does this need to be changed for tomcat 4.1.18
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>IntranetTV</display-name>
<description>
Guide
</description>
<servlet>
<servlet-name>IntranetTV</servlet-name>
<servlet-class>com.bt.intranettv.view.IntranetTV</servlet-class>
<init-param>
<param-name>root</param-name>
<param-value>D:\intranettv\admin\public_site\</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>IntranetTV</servlet-name>
<url-pattern>/IntranetTV</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ManageContent</servlet-name>
<servlet-class>com.bt.intranettv.admin.ManageContent</servlet-class>
<init-param>
<param-name>root</param-name>
<param-value>D:\intranettv\admin\public_site\</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ManageContent</servlet-name>
<url-pattern>/ManageContent</url-pattern>
</servlet-mapping>
</web-app>
[ February 10, 2003: Message edited by: tradester amagio ]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

When i try to add this context to tomcat 4.1.18 server.xml it goes a bit mental and complains about parser errors in web.xml


It would help to know what the exact error is. If you've got a tag out of place, it should say that.

At first glance, and I'm not even looking at the DTD, it's unusual to have in XML something like: <a> <b> <a> <b>. So servlet then servlet-mapping, and back to servlet and servlet-mapping makes me suspicious. It should probably be <a> <a> <b> <b>

You've also got a special character in your post.. make sure you don't have a 'hidden' special character in your web.xml file (that won't show on a text editor, but would show up in say, Microsoft Word).
tradester amagio
Greenhorn

Joined: Feb 10, 2003
Posts: 6
basically all i want to know is what I have to add to the server.xml so I can use my own path to my classes. and also want to know what is the minimum I need to put in the web.xml for tomcat 4.1.18. What is the structure for these web.xml. I dont be able to find any great examples of what should be included and what is the minimum to get away with.
The web.xml works fine with tomcat 3.2.1 but I havent modified it for tomcat 4.1.18. Therefore how do you modify tomcat 3.2.1 web.xml to change to tomcat 4.1.18??
Is adding the context for server.xml, in the way ive previously noted, correct for tomcat 4.1.18???
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Originally posted by tradester amagio:
<servlet>
<servlet-name>IntranetTV</servlet-name>
<servlet-class>com.bt.intranettv.view.IntranetTV</servlet-class>
<init-param>
<param-name>root</param-name>
<param-value>D:\intranettv\admin\public_site\</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>IntranetTV</servlet-name>
<url-pattern>/IntranetTV</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ManageContent</servlet-name>
<servlet-class>com.bt.intranettv.admin.ManageContent</servlet-class>
<init-param>
<param-name>root</param-name>
<param-value>D:\intranettv\admin\public_site\</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>ManageContent</servlet-name>
<url-pattern>/ManageContent</url-pattern>
</servlet-mapping>

The order of the tags shall be <servlet />...<servlet /> <servlet-mapping />...<servlet-mapping />
Rene


Regards, Rene Larsen
Dropbox Invite
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting servlet to work with TOMCAT4.1.18
 
Similar Threads
trouble with war file
Cant get my first jsf page to render :-(
HelloWorld servlet not working
Struts 1.1 - Tomcat 4.1.30 deployment problem
Problems with tomcat 4.1.18 - migration from tomcat 3.2.1