> From: mdunford [mailto:martin.dunf...@gmail.com]
> Subject: RE: Tomcat 6.0.18 examples recompile ok but dont work!!

> I go and recompile HelloWorldExample 
> javac HelloWorldExample.java

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 HelloWorldExample.java

>     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


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus 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: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to