Boa tarde!
Subi minha aplicação com Vraptor 3 para o UolHost e está ocorrendo estouro de memória.
A aplicação sobre sem problemas, mas está logando um erro no criadorDeSession.
Fiz essa arquitetura com base na apostila do Vraptor.
Segue abaixo o trace do erro, e classe.
9:05:40,969 INFO [VRaptor ] VRaptor 3.4.1 successfuly initialized
java.lang.OutOfMemoryError: PermGen space
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeClassHeaderName1(Parser.java:2666)
at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:6189)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11053)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11301)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11258)
at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:9673)
at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:718)
at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:383)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:428)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:379)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:662)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at br.com.caelum.vraptor.core.DefaultStaticContentHandler.deferProcessingToContainer(DefaultStaticContentHandler.java:69)
at br.com.caelum.vraptor.VRaptor.doFilter(VRaptor.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338)
at br.com.caelum.vraptor.view.DefaultPageResult.defaultView(DefaultPageResult.java:67)
19:05:51,393 WARN [CommonAnnotationBeanPostProcessor] Invocation of destroy method failed on bean with name ‘criadorDeSession’: java.lang.OutOfMemoryError: PermGen space
Exception in thread “http-bio-8080-exec-2” java.lang.OutOfMemoryError: PermGen space
at java.lang.ClassLoader.findBootstrapClass(Native Method)
at java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1070)
at java.lang.ClassLoader.loadClass(ClassLoader.java:414)
at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:412)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:469)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Exception in thread “ContainerBackgroundProcessor[StandardEngine[Catalina]]” java.lang.OutOfMemoryError: PermGen space
Exception in thread "http-bio-8080-exec-12"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "http-bio-8080-exec-12"
Exception in thread "http-bio-8080-exec-6"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread “http-bio-8080-exec-6”
identar texto pre-formatado em 4 espaços
package br.com.otimo.reviv.infra;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.hibernate.Session;
import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.ComponentFactory;
import org.hibernate.SessionFactory;
@Component
public class CriadorDeSession implements ComponentFactory{
private SessionFactory factory;
private Session session;
public CriadorDeSession(SessionFactory factory){
this.factory = factory;
}
@PostConstruct
public void abre(){
this.session = factory.openSession();
}
public Session getInstance(){
return this.session;
}
@PreDestroy
public void fecha(){
this.session.close();
}
}