[ Team LiB ] Previous Section Next Section

Q&A

Q1:

Why do I get a 404 (File Not Found) error when I access the JavaServer Page?

A1:

You are probably putting the JSP in a directory that the Web server can't get to. If you have an HTML page that you can access from the Web server, put the JSP in the same directory and see whether you can get to it.

Q2:

Why do I get a 500 (Internal Server Error) error when I access the JSP?

A2:

Usually, a 500 error is caused by a miscommunication between the Web server and the JSP container, or by an error in the JSP container. Check to make sure that you have configured your JSP container properly. Another possibility is that you are having problems compiling the source code produced by the container. Inspecting the resulting page or error logs will usually provide a clue as to where your code is faulty. Often, the information includes line numbers.

Q3:

Why do I get an error saying No Compiler Available or unable to locate "com.sun.tools.javac.Main?

A3:

The JSP container converts your JSPs into Java classes and then compiles them. To compile them, it needs a Java compiler. You need to install either a full JDK or at least get the tools.jar file from an existing JDK installation and put it in your classpath. This error occurs mostly when you have installed only the JRE (Java Runtime Environment), which does not come with a Java compiler.

Q4:

Why do I see bizarre compiler errors, such as expected } or no catch/finally clause?

A4:

You probably forgot an opening <% or a closing %>.

Q5:

Instead of seeing an HTML page, why do I see the source code for my JSP?

A5:

You don't have the JSP container set up correctly. The Web server doesn't understand that the JSP container is supposed to handle filenames ending in .jsp. You might need to reinstall your JSP container.


    [ Team LiB ] Previous Section Next Section