tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Caldarale, Charles R" <>
Subject RE: Tomcat 6.0.18 examples recompile ok but dont work!!
Date Fri, 03 Apr 2009 03:25:38 GMT
> From: mdunford []
> Subject: RE: Tomcat 6.0.18 examples recompile ok but dont work!!

> I go and recompile HelloWorldExample 
> javac

That's not sufficient to compile a servlet.  You will also need a -cp argument to inform the
compiler where servlet-api.jar is located.  If you attempt to do this via the CLASSPATH environment
variable - don't.  Using the CLASSPATH variable is a major cause of classloading confusion
and difficult to diagnose problems.  If you have CLASSPATH defined, get rid of it before doing
anything else, and smack yourself if you ever feel tempted to use it again.

When your current directory is ${catalina.base}/webapps/examples/WEB-INF/classes, your javac
line should look like this:

javac -cp ../../../../lib/servlet-api.jar

>     Sure enough log shows
>     0:0:0:0:0:0:0:1%0 - - [02/Apr/2009:15:48:58 -0400] "GET
> /examples/servlets/servlet/HelloWorldExample HTTP/1.1" 404 952

I've done the same thing on my 6.0.18 installation, and it works fine.  Do you have a JAVA_HOME
or JRE_HOME environment variable set?  If so, what's the value?

You should also be able to find additional information in the logs, including a possible stack
trace of the underlying problem.

> There has never been an examples/servlets/servlet directory...

Don't confuse URL paths with file system paths - they're independent.  If you look in webapps/examples/WEB-INF/web.xml,
you'll see a servlet mapping for /servlets/servlet/HelloWorldExample that targets the servlet
named HelloWorldExample, which is configured to use the HelloWorldExample.class.

 - Chuck

for use only by the intended recipient. If you received this in error, please contact the
sender and delete the e-mail and its attachments from all computers.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message