This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Unable to compile class for JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Unable to compile class for JSP" Watch "Unable to compile class for JSP" New topic

Unable to compile class for JSP

Ashley Patten

Joined: Sep 23, 2011
Posts: 2

Does anyone know how to go about fixing the error below; I have spent a good 12 hours trying to work it out.

HTTP Status 500 -

type Exception report


description The server encountered an internal error () that prevented it from fulfilling this request.


org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 18 in the generated java file
The return type is incompatible with JspSourceDependent.getDependants()


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.
Apache Tomcat/6.0.33
harib raghu

Joined: Sep 18, 2011
Posts: 5
this could be the result of the type cast error..u see the message RETURN TYPE NOT COMPATIBLE..and ..also a COMPILATION error..which means
there is some function parameter incompatibility or return type not in line with the assigned variable..
if you list the code it can help a bit..
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15951

The way you fix errors like that is to not put Java code in JSPs. We have better ways to do stuff like that now.

And besides, as you have discovered, it's a lot harder to debug coding errors when you use scriptlets. This wasn't a problem with JSPs - it was a problem with the Java code ON the JSP.

Customer surveys are for companies who didn't pay proper attention to begin with.
Ashley Patten

Joined: Sep 23, 2011
Posts: 2
Thanks for your replies; I managed to get around this problem by using tomcat 5 rather than 6.
I agree. Here's the link:
subject: Unable to compile class for JSP
Similar Threads
When JSP page is compiled?
Error compiling JSP
Exception thrown org.jboss.util.NestedSQLException
JAVA_HOME does not point to the JDK
Struts Example not working!