[ Team LiB ] Previous Section Next Section

Q&A

Q1:

Why won't my servlet compile? The compiler reports that it can't find the javax.servlet package.

A1:

Your classpath isn't set up correctly. You need to locate the servlet-api.jar file (it might have a different name) and add it to your classpath.

Q2:

I put my WAR file in Tomcat's webapps directory; why isn't Tomcat unpacking it?

A2:

If Tomcat doesn't unpack the WAR file in the webapps directory, look in Tomcat's logs directory for an error or output file. If you are using Tomcat 4.0 or 5.0, look at the catalina.out file. It may contain errors relating to your WAR file. Also, make sure that the file is named .war and not .jar.

Q3:

Why does the Web server give me a 404 (File Not Found) error or a 500 (Internal Server Error)?

A3:

This is usually either an installation problem or a classpath issue. One way to check the installation is to run one of the default servlets that comes with the servlet container. If you can't run one of the defaults, you need to check your servlet container's configuration and possibly reinstall it. If you can run the default servlet, but not your own, your classpath probably doesn't point to your servlet. Also, if you change the classpath after you have started the servlet container, you need to restart the servlet container to pick up the changes.


    [ Team LiB ] Previous Section Next Section