Bom dia,
como posso fazer para evitar ou ao menos minimizar a exceção java.lang.OutOfMemoryError: PermGen space ? Após algumas alterações em código e reinicialização automática do tomcat, ele lança essa exceção:
08/06/2017 08:29:55 org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/livraria] has started
08/06/2017 08:29:55 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
GRAVE: The web application [/livraria] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
08/06/2017 08:29:55 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
GRAVE: The web application [/livraria] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak.
08/06/2017 08:29:55 org.apache.catalina.startup.TldConfig execute
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.
08/06/2017 08:29:55 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Inicializando Mojarra 2.1.14 ( 20121023-1153) para o contexto '/livraria'
08/06/2017 08:29:55 com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: Anotações PostConstruct/PreDestroy presentes. Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
08/06/2017 08:29:56 org.hibernate.validator.internal.util.Version <clinit>
INFO: HV000001: Hibernate Validator 4.3.0.Final
08/06/2017 08:29:56 org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/livraria] is completed
08/06/2017 08:30:16 org.apache.catalina.core.StandardContext reload
INFO: Reloading Context with name [/livraria] has started
08/06/2017 08:30:17 org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor run
GRAVE: Unexpected death of background thread ContainerBackgroundProcessor[StandardEngine[Catalina]]
java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3205)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.util.Introspection.loadClass(Introspection.java:143)
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2182)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2120)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1981)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1942)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1927)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1332)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:888)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5522)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4138)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1341)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5958)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1542)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1520)
at java.lang.Thread.run(Thread.java:662)
Exception in thread "ContainerBackgroundProcessor[StandardEngine[Catalina]]" java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3205)
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1373)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1861)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at org.apache.catalina.util.Introspection.loadClass(Introspection.java:143)
at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2182)
at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:2120)
at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1981)
at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1942)
at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1927)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1332)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:888)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5522)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:4138)
at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:425)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1341)
at org.apache.catalina.core.StandardContext.backgroundProcess(StandardContext.java:5958)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1542)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1552)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1520)
at java.lang.Thread.run(Thread.java:662)