title: java.lang.OutOfMemoryError ( PermGen space) and java.lang.ClassNotFoundException at the opening the jsp page
body: <p>I use SpringSource Tool Suite 3.0.1, Tomcat server 7.0.21, maven-2.2.1. 
  I successfully built my web application, ran Tomcat server. The application successfully worked. After restart Tomcat server I saw by turns the next errors with exceptions on web-page login.jsp:</p>
  
  <pre><code>org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space
  
  type Exception report
  
  message
  
  description The server encountered an internal error () that prevented it from fulfilling this request.
  
  exception
  
  org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:839)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  root cause
  
  java.lang.OutOfMemoryError: PermGen space
      java.lang.ClassLoader.defineClass1(Native Method)
      java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      org.eclipse.jdt.internal.compiler.parser.Parser.createJavadocParser(Parser.java:8256)
      org.eclipse.jdt.internal.compiler.parser.Parser.&lt;init&gt;(Parser.java:889)
      org.eclipse.jdt.internal.compiler.Compiler.initializeParser(Compiler.java:685)
      org.eclipse.jdt.internal.compiler.Compiler.&lt;init&gt;(Compiler.java:283)
      org.eclipse.jdt.internal.compiler.Compiler.&lt;init&gt;(Compiler.java:204)
      org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:442)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:644)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  note The full stack trace of the root cause is available in the Apache Tomcat/7.0.21 logs.
  </code></pre>
  
  <p>and</p>
  
  <pre><code>type Exception report
  
  message
  
  description The server encountered an internal error () that prevented it from fulfilling this request.
  
  exception
  
  org.apache.jasper.JasperException: java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.login_jsp
      org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:178)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  root cause
  
  java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.login_jsp
      java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
      org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
      org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
  note The full stack trace of the root cause is available in the Apache Tomcat/7.0.21 logs.
  </code></pre>
  
  <p>login.jsp - the home page is configured by SpringSecurity.</p>
  
  <p>I don't understand the source of problem, because I did not rebuild project. 
  After that I try several ways for error recovery:</p>
  
  <ul>
  <li>Refresh project</li>
  <li>Clean and rebuild project</li>
  <li>Update maven dependency</li>
  <li>Clean Tomcat work directory</li>
  <li>Clean... button from server menu</li>
  </ul>
  
  <p>Nothing of the ways did not help me.
  But the internal logic of the application works properly (it is not associated with the Web interface). I get appropriate log messages. But as soon as I open page login.jsp, I get the error messages.
  Then I tried to revert to the previous stable version of the project. Unfortunately I got the same errors.</p>
  
  <p>Log in the console displays the following messages before output the error messages on the page logon.jsp:</p>
  
  <pre><code>02.04.2012 11:22:41 org.apache.jasper.compiler.TldLocationsCache tldScanJar
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  02.04.2012 11:22:44 org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [appServlet] in context with path [/main] threw exception [Handler processing failed; nested exception is java.lang.OutOfMemoryError: PermGen space] with root cause
  java.lang.OutOfMemoryError: PermGen space
  </code></pre>
  
  <p>I found similar questions: <a href="http://www.mail-archive.com/users@tomcat.apache.org/msg54797.html" rel="noreferrer">http://www.mail-archive.com/users@tomcat.apache.org/msg54797.html</a> and <a href="http://wiki.metawerx.net/wiki/Org.apache.jasper.JasperException" rel="noreferrer">http://wiki.metawerx.net/wiki/Org.apache.jasper.JasperException</a>. But it did not help me.</p>
  
  <p>How to solve this problem?</p>