简体   繁体   中英

Arquillian with tomcat7 running into Java Heap Space problems, only on linux

we are running arquillian with tomcat 7...
With the MAC from my colleague the test works fine, but at my linux computer (we both have 8gb ram) it failes with:

FATAL: Error waiting for multi-thread deployment of WAR files to complete
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space

when i start my test, i see in the stack this line:

14:05:56.482 INFO - Starting Tomcat with: [java, -Dcom.sun.management.jmxremote.port=8089, -Dcom.sun.management.jmxremote.ssl=false, -Dcom.sun.management.jmxremote.authenticate=false, -Xmx512m, -XX:MaxPermSize=128m, -classpath, /home/user/apache-tomcat-testing/bin/bootstrap.jar:/home/user/apache-tomcat-testing/bin/tomcat-juli.jar, -Djava.endorsed.dirs=/home/user/apache-tomcat-testing/endorsed, -Dcatalina.base=/home/user/apache-tomcat-testing, -Dcatalina.home=/home/user/apache-tomcat-testing, -Djava.io.tmpdir=/home/user/apache-tomcat-testing/temp, org.apache.catalina.startup.Bootstrap, -config, /home/user/apache-tomcat-testing/conf/server.xml, start]

i tried to edit the bin/catalina.sh with

JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms2048m -Xmx2048m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:+DisableExplicitGC"

but it still has the xmx=512m in the stack.
i also added in the pom.xml the <argLine>-Xms2048m -Xmx2048m</argLine> for failsafe-maven-plugin and for the maven-surefire-plugin but still the same error...

Where is the right place to change the xmx for the arquillian testing?

thank you!

It appears that you're using the Arquillian managed Tomcat 7 container. Use the javaVmArguments property in arquillian.xml to specify the Xmx values:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian"
    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

    <container qualifier="tomcat" default="true">
        <configuration>
            <property name="catalinaHome">${CATALINA_HOME:target/apache-tomcat-7.0.20}</property>
            <property name="javaVmArguments">-Xms2048m -Xmx2048m</property>
            <property name="jmxPort">8089</property>
            <property name="bindHttpPort">8080</property>
            <property name="user">manager</property>
            <property name="pass">password</property>
            <property name="serverConfig">server.xml</property>
        </configuration>
    </container>
</arquillian>

The complete reference to the properties supported for the managed Tomcat 7 container is in the Arquillian Confluence wiki .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM