File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts 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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unable to compile class for JSP" Watch "Unable to compile class for JSP" New topic
Author

Unable to compile class for JSP

Ramna Reddy
Ranch Hand

Joined: Aug 06, 2006
Posts: 96
Hello ranchers,
Iam getting this problem quite frequently...some jsp files in my application are not able to compile as the code increases...throws the following exception.
Please provide some permanent solution.
Thank you all of you in advance.



org.apache.jasper.JasperException: Unable to compile class for JSP
Generated servlet error:
The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit..

at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:414)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:297)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
Java class files have several limits they need to obey, like number of methods and code size in bytes of all methods. The permanent solution would be to redesign your JSP so that it doesn't include so much code. It's considered bad design to keep Java code in a JSP anyway.
Ramna Reddy
Ranch Hand

Joined: Aug 06, 2006
Posts: 96
It's considered bad design to keep Java code in a JSP anyway.

Iam not using any java code in jsp, but it has lot of struts-tags.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I know some people have been able to get around this by breaking up their JSPs
and pasting them together at run time with jsp:include actions.

I'm going to move this to our Struts forum where you can get better advice on best practices for Struts apps.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 467
Originally posted by Ben Souther:

I'm going to move this to our Struts forum where you can get better advice on best practices for Struts apps.


Actually, this has nothing to do with struts.


Visit my blog: http://jnassef.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Unable to compile class for JSP