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 Tomcat newbie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat newbie" Watch "Tomcat newbie" New topic
Author

Tomcat newbie

chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Hi, i'm new to Tomcat. Last time i ran a servlet was on jsdwk1.0.1..
I now have Tomcat 4.0.2 with jdk1.3.0. Are they compatible?
How do i run the example servlets that came with Tomcat?
Your feedback will be greatly appreciated.
Ravi Veera
Ranch Hand

Joined: Jun 23, 2001
Posts: 127
This article is a good starting point. There are
more beginner articles related to Tomcat on this site.
Ravihttp://www.onjava.com/pub/a/onjava/2001/03/29/tomcat.html
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
yes.. they are compatible! and recommended!
The examples are there. After you start tomcat.
go to http://localhost:port/name_of_webapp/
thats it.
or just go to http://localhost:port/ it will have links to the examples that came with tomcat.



Edited by MC to remove smilies At the bottom of the form you fill out, there is a checkbox that says "disable smilies in this post". Use this when you have things like :P in your post (:port or jdbc urls are common)
[ March 10, 2002: Message edited by: Mike Curwen ]
Fei Ng
Ranch Hand

Joined: Aug 26, 2000
Posts: 1242
I am not sure why the faces.
it is http://localhost: port/
no space with : and port. If i take out the space it will become a face.
good luck.
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Thank you both Fei and Ravi for replying.
I was missing the Tomcat_home environment variable. I managed to get the http://localhost:8080 to come up, but then i tried the servlet link on it i got

I also have Java_Home set up ( in short my jdk runs fine).. I followed the instruction on the website provided by Ravi and got stuck at that point where my link returned a 404.. ? the examples/servlet directly is there..
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by FEI NG:
I am not sure why the faces.
There's a checkbox at the bottom of the screen that let's you turn off smilies when posting. the combination of : and p turns into


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Am i supposed to modify the .xml file that is included in the installation? I cannot run the examples that came with Tomcat. I've got Tomcat_home, Catalina_home and java_home all set.. what else do i need to run the examples?

TIA
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

No, you shouldn't need to modify the web.xml or server.xml at all.

What do you have CATALINA_HOME and JAVA_HOME set at? It should be something like:
CATALINA_HOME=d:\program files\Apache Tomcat
JAVA_HOME=d:\jdk1.3.0

note that CATALINA_HOME does not include the bin subdirectory, and neither does JAVA_HOME.

Lastly, try it with all capital letters.
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Java_HOME is set to
e:\jdk1.3
CATALINA_HOME is set to
e:\program files\Apache Tomcat 4.0
Tomcat starts fine as i've changed the port number to 80 and i can still see the index page. I cannot access the examples via the links on the index page, however. I kept getting 404.
Your help would be greatly appreciated!
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Please, your assistance will be greatly appreciated.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
What do the Tomcat logs say?
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
This is what is in localhost_examples_log.2002-03-20.txt

2002-03-20 13:58:48 WebappLoader[/examples]: Deploying class repositories to work directory E:\Program Files\Apache Tomcat 4.0\work\localhost\examples
2002-03-20 13:58:48 WebappLoader[/examples]: Reloading checks are enabled for this Context
2002-03-20 13:58:48 StandardManager[/examples]: Seeding random number generator class java.security.SecureRandom
2002-03-20 13:58:48 StandardManager[/examples]: Seeding of random number generator has been completed
2002-03-20 13:58:50 ContextConfig[/examples]: Configured an authenticator for method FORM
2002-03-20 13:58:50 ContextListener: contextInitialized()
2002-03-20 13:58:50 SessionListener: contextInitialized()
2002-03-20 13:58:50 StandardContext[/examples]: Exception starting filter Compression Filter
java.lang.NoSuchMethodError
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:314)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3064)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3382)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
2002-03-20 13:58:50 StandardContext[/examples]: Exception starting filter Servlet Mapped Filter
java.lang.NoSuchMethodError
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:314)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3064)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3382)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
2002-03-20 13:58:50 StandardContext[/examples]: Exception starting filter Set Character Encoding
java.lang.NoSuchMethodError
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:314)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3064)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3382)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
2002-03-20 13:58:50 StandardContext[/examples]: Exception starting filter Request Dumper Filter
java.lang.NoSuchMethodError
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:314)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3064)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3382)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
2002-03-20 13:58:50 StandardContext[/examples]: Exception starting filter Path Mapped Filter
java.lang.NoSuchMethodError
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:254)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:314)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:120)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3064)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3382)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:614)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1123)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:343)
at org.apache.catalina.core.StandardService.start(StandardService.java:388)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:506)
at org.apache.catalina.startup.Catalina.start(Catalina.java:781)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:681)
at org.apache.catalina.startup.Catalina.process(Catalina.java:179)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:243)
2002-03-20 13:58:50 StandardContext[/examples]: Context startup failed due to previous errors
2002-03-20 13:58:50 SessionListener: contextDestroyed()
2002-03-20 13:58:50 ContextListener: contextDestroyed()

Seems like the Exception starting filter for Compression Filter is the first problem, though i just have no clue on what is causing it.
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

From your very first post:
Last time i ran a servlet was on jsdwk1.0.1
Make sure that there are no older versions of servlet.jar or anything else that might be hiding in your system CLASSPATH. Tomcat 4.x is not supposed to use system CLASSPATH, but you never know, and it certainly wouldn't hurt to remove it, since you will be using the new version.

Also make sure you haven't added any of these older jars by accident into Tomcat's lib or common/lib or even the examples/WEB-INF directory.

There was a bug report on this on Tomcat's buzilla, but it was closed without further investigation as "invalid". Here is that "bug":
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3850
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
From the bug report:
"That kind of class cast exceptions usually occur if you have the 2.2 version of the servlet API JAR in common/lib (or more generally, somewhere where the old classes could override the new classes - like in /WEB-INF/lib)."
chafule razgul
Ranch Hand

Joined: Feb 09, 2002
Posts: 63
Thank you all who replied, particularly to Mike and Thomas.
It turns out that i had indeed multple servlet.jars in my environment variable declarations. After removing them and upgrading my jdk to the latest version i was able to install tomcat without much problems.
Thank you again
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat newbie