File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes java.lang.OutOfMemoryError and 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 Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "java.lang.OutOfMemoryError and Unable to compile class for JSP" Watch "java.lang.OutOfMemoryError and Unable to compile class for JSP" New topic
Author

java.lang.OutOfMemoryError and Unable to compile class for JSP

Sundar pandian
Greenhorn

Joined: Apr 20, 2012
Posts: 3
Hi All,

I am new to this java related things.. I am working in Web application where we manage data and files. When I click a webpage for for invoking a functionality I am getting this two errors. When I try for the first time I get as below (javax.servlet.ServletException: java.lang.OutOfMemoryError) marked in italic.

After closing this window and clicking on same functionality I am getting Unable to compile class for JSP as a second error marked in Bold.

javax.servlet.ServletException: java.lang.OutOfMemoryError
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:275)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

java.lang.OutOfMemoryError
java.util.zip.ZipFile.open(Native Method)
java.util.zip.ZipFile.<init>(ZipFile.java:203)
java.util.jar.JarFile.<init>(JarFile.java:132)
java.util.jar.JarFile.<init>(JarFile.java:97)
org.apache.catalina.loader.WebappClassLoader.openJARs(WebappClassLoader.java:1756)
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1996)
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:961)
org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1182)
org.apache.jasper.servlet.JasperLoader.getResourceAsStream(JasperLoader.java:144)
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:193)
org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:122)
org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:178)
org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2391)
org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2129)
org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:44)
org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:134)
org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:138)
org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing(Block.java:115)
org.eclipse.jdt.internal.compiler.ast.TryStatement.resolve(TryStatement.java:799)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:429)
org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:196)
org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:400)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1085)
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1164)
org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:366)
org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:623)
org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)




This is Second error message

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: org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:486)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:338)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

root cause

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Is there any relationships between this two error messages. Can you please help with your comments.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

Either you have one very large JAR file on your class path, or you have to many JAR files. How much memory have you assigned to Tomcat?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Sundar pandian
Greenhorn

Joined: Apr 20, 2012
Posts: 3
Hi Rob,

Where I need to check this tomcat memory info..Sorry for the stupid question as I am bit new to Tomcat stuff
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

It depends on how you start Tomcat. If you installed it on Windows using the installer, there is a Tomcat configuration tool available. With this you can specify how much memory the JVM allocates for Tomcat (as well as other JVM properties).
If you installed Tomcat without the installer (i.e. from a ZIP file) or are using Linux then I cannot tell you where to change this.
Sundar pandian
Greenhorn

Joined: Apr 20, 2012
Posts: 3
Hi Rob,

Thanks for getting back. This problem got cleared when I gone for server restart.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19783
    
  20

You're welcome.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.OutOfMemoryError and Unable to compile class for JSP