java.lang.OutOfMemoryError: PermGen space Arquillian Glassfish Embedded
casta_oh May 23, 2014 9:21 AMHi all.
I am facing with a great problem.
When I execute my test with Arquillian (just Arquillian and also Arquillian Persistence), my test executes ok. Also If I execute ir as "Run As" JUnit Test in Eclipse.
When I execute all the tests in my project, hitting Run As Junit over the project in Eclipse, almost all the test works fine, but I get this error in one test:
Exception in thread "Thread-0" java.lang.OutOfMemoryError: PermGen space
It means that I have completely fill my Pergem with the classloader. Why this? Because I have executed a lot of test with Arquillian. Each test deploys one new JAR or WAR. With the admin process manager of Windows I have seen that the java process of Arquillian grows up till 256 MB. At this point it crashed, don`t grows up any more and from this moment al the tests with Arquillian fail.
If I run mvn test it is worst, because fail much more tests.
I suppose that the gargabe collector isn`t working amongs tests, so the classes remains in the memory.
So, since ARQUILLIAN deploys always a new war, how can I solve this problem?
1. Can I have only one super war deployed in the beginning and use the same till the end?
2. Can I invoke GC just after each test, so I can free the memory? I have tried this without success, because after the first war, then the others don`t get deployed.
<property name="maxTestClassesBeforeRestart">1</property>
3. Can I have same war deployed for several tests?
What I need is some kind of hint or document to test in large applications. I have googled a lot and I don`t find the proper information.
JDK6.
Glassfish Embedded 3.1.2.2
Arquillian 1.1.3.Final (if I user 1.1.4.Final, then if I have some kind of error in the injection of CDI beans, then arquillian doesn`t show me the error Re: Injecting EJB into tests )
Arquillian Persistence 1.0.0.Alpha6.
Regards in advantaje.
23-may-2014 15:08:39 org.apache.catalina.session.ManagerBase log
INFO: PWC2787: Session event listener threw exception
java.lang.OutOfMemoryError: PermGen space
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:59)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:28)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.session.StandardSession.fireContainerEvent(StandardSession.java:2155)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:808)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:769)
at org.apache.catalina.session.StandardSession.expire(StandardSession.java:757)
at org.apache.catalina.session.StandardSession.invalidate(StandardSession.java:1475)
at org.apache.catalina.session.StandardSessionFacade.invalidate(StandardSessionFacade.java:204)
at org.jboss.jsfunit.arquillian.container.JSFUnitCleanupTestTreadFilter.cleanUp(JSFUnitCleanupTestTreadFilter.java:67)
at org.jboss.jsfunit.arquillian.container.JSFUnitCleanupTestTreadFilter.doFilter(JSFUnitCleanupTestTreadFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
classLoader = WebappClassLoader (delegate=true; repositories=WEB-INF/classes/)
SharedSecrets.getJavaNetAccess()=java.net.URLClassLoader$7@f18cc3
PlainTextActionReporterSUCCESSNo monitoring data to report.
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 15.287 sec
Running com.gneis.ebkextracto.view.converter.IntegerConverterTest
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.025 sec <<< FAILURE!
Running com.gneis.ebkextracto.view.validator.PeriodoValidatorTest
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.788 sec
java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-5" java.lang.OutOfMemoryError: PermGen space
Exception in thread "Thread-0" java.lang.OutOfMemoryError: PermGen space
Results :