• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Running Tomcat JSP and Servlet examples

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having a problem getting Tomcat (4.1.30) to work on my PowerBook (OS X 10.2.6)
When I start Tomcat and enter 'http://127.0.0.1:8080', I get the Tomcat home page as expected. When I click on any of the links to the examples, I get an http Status 404 error report, saying that the requested resource is not available. This occurs whether or not I have Personal Web Serving enabled.
When I last got tomcat working (some years ago), I used mod_jserv and modified httpd.conf to get the two working together. I've had no joy adding the mod_webapp module to the apache httpd.conf file using Liz's instructions (http://developer.apple.com/internet/java/tomcat1.html), as the WebAppDeploy line fails.
Can anyone tell me whether it's an Apache or Tomcat configuration oversight on my part, or better still how to fix it, or best-of-the-best-3-it's-nothing-personal - is there a preferred version of Liz's article out there somewhere?
Thanks in advance,
Ian.
 
Marshal
Posts: 67280
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are explicitly specifying port 8080, you are bypassing Apache completely (which listens on port 80). Don't know if that's part of your problem, or if it helps you remove Apache from the equation.
I've never had any problems with Tomcat "out of the box"... but I haven't tried to set up an Apache mod to link them either.
[ March 18, 2004: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As it happens I just yesterday installed this precise version of Tomcat on a system running OS X 10.1.5. The examples worked out of the box.
Take a look at the files in the log directory under the tomcat root directory. There should be some messages in there indicating why it failed to load the examples. If the files are too big to inspect manually, try grepping for 'example'.
 
Ian Foster
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So our hero sallied forth into the log directory and found...
The results of 'cat'ing localhost_examples_log.2004-03-19.txt from the log directory included the following:
2004-03-19 08:10:59 WebappLoader[/examples]: Deploying class repositories to work directory /usr/local/jakarta-tomcat-4.1.30/work/Standalone/localhost/examples
2004-03-19 08:10:59 WebappLoader[/examples]: Deploy class files /WEB-INF/classes to /usr/local/jakarta-tomcat-4.1.30/webapps/examples/WEB-INF/classes
2004-03-19 08:10:59 WebappLoader[/examples]: Reloading checks are enabled for this Context
.
.
2004-03-19 08:11:00 StandardContext[/examples]: Exception starting filter Set Character Encoding
java.lang.ClassNotFoundException: filters.SetCharacterEncodingFilter
at .apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1443)
.
.
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
at java.lang.reflect.Method.invoke(Native Method)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
2004-03-19 08:11:00 StandardContext[/examples]: Context startup failed due to previous errors
Firstly, the filters.SetCharacterEncodingFilter class can't be found - any clues as to why and where I might get one from?
Second, I'm a little surprised to see 'java.lang.reflect.Method.invoke(Native Method)' - is the one UNIX distribution going to work for all flavours of UNIX?
Thanks for getting me this far,
Ian.
 
Loren Rosen
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my tomcat installation that class is in
webapps/examples/WEB-INF/classes/filters/SetCharacterEncodingFilter.class
Most likely your tomcat install is slightly broken and that file is either missing, or has its name truncated. The truncation can happen if you, during installation of tomcat, unpack the tomcat tar file with some program that doesn't properly deal with file names with more than 32 characters. Stuffit, at least older versions, is a likely culprit. I always use gnutar to unpack tar files.
Regarding the native code in the stack trace -- java.lang.reflect.Method.invoke is part of the java install itself, so it will be there in any java port. In other words using it won't create an operating system dependencies.
 
Ian Foster
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And suddenly everything worked fine.
Thanks team, I've got all the examples running and am able to add new servlets to an existing context. Still having problems with deploying servlets to a new context though - I keep on getting the '404 - resource unavailable' error. No errors at startup, nothing in the log files to suggest that there's a problem.
I'll make another post once I work out what piece of th ejigsaw I've forgotton.
Thanks again.
 
I am a man of mystery. Mostly because of this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!