wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Unable to compile class for JSP" Watch "Unable to compile class for JSP" New topic
Author

Unable to compile class for JSP

Ashley Patten
Greenhorn

Joined: Sep 23, 2011
Posts: 2
Hi,

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

message

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

exception

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()

Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:93)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:319)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:298)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:302)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
com.jenkov.servlet.multipart.MultipartFilter.doFilter(MultipartFilter.java:93)

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
Greenhorn

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: 15959
    
  19

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
Greenhorn

Joined: Sep 23, 2011
Posts: 2
Thanks for your replies; I managed to get around this problem by using tomcat 5 rather than 6.
 
Don't get me started about those stupid light bulbs.
 
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!