Question

I have a library (vraptor-test) that does unit testing at my webservices in my maven project. In onder to run these tests, this library starts an embedded Tomcat.

Tomcat tomcat = new Tomcat();

I have checked the dependency tree, and the list below representss tomcat related jars added to my project by the test library:

+- org.apache.tomcat:tomcat-catalina:jar:7.0.23:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.23:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-juli:jar:7.0.23:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-annotations-api:jar:7.0.23:compile
[INFO] |  |  +- org.apache.tomcat:tomcat-api:jar:7.0.23:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-util:jar:7.0.23:compile
[INFO] |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.23:compile
[INFO] |  \- org.apache.tomcat:tomcat-jasper:jar:7.0.23:compile
[INFO] |     +- org.apache.tomcat:tomcat-jsp-api:jar:7.0.23:compile
[INFO] |     +- org.apache.tomcat:tomcat-el-api:jar:7.0.23:compile
[INFO] |     +- org.eclipse.jdt.core.compiler:ecj:jar:3.7:compile
[INFO] |     \- org.apache.tomcat:tomcat-jasper-el:jar:7.0.23:compile

When I run my test classes the error below pops up and the test doesn't even complete:

SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: PermGen space

Usually, I would make changes to setenv.bat under tomcat folder to increase the PermGem space, but, since I'm running an embedded Tomcat, I can't find its folder, only its jars.

I've tried increasing JVM memory in Eclipse (Window -> Preferences -> Java -> Installed JREs -> jdk -> Edit -> Default Vm Arguments) to -Xmx1024M -Xms1024M -XX:PermSize=2048m -XX:MaxPermSize=2048m but I'm still getting the same error.

Where can I change permgem space of my embedded tomcat?

Was it helpful?

Solution

Double-click on your Tomcat service under the Servers tab, and click on the "Open launch configuration" to open the Tomcat launch configuration window. Then, in their change your VM args (different from default VM args).

EDIT: If you are running a JAR from a Junit Test, you will need to change the VM Arguments in the Junit Launch configruation. You can view your Run/Debug launch configs and then edit the arguments tab.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top