系统相关
首页 > 系统相关> > Arquillian与tomcat7运行Java Heap Space问题,仅在linux上运行

Arquillian与tomcat7运行Java Heap Space问题,仅在linux上运行

作者:互联网

我们用tomcat 7运行arquillian …
使用我的同事的MAC测试工作正常,但在我的Linux计算机上(我们都有8gb ram)它很容易:

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

当我开始测试时,我在堆栈中看到这一行:

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]

我试着编辑bin / catalina.sh

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"

但它仍然有堆栈中的xmx = 512m.
我还在pom.xml中添加了< argLine> -Xms2048m -Xmx2048m< / argLine>对于failsafe-maven-plugin和maven-surefire-plugin,但仍然是同样的错误……

在arquillian测试中更改xmx的正确位置在哪里?

谢谢!

解决方法:

您似乎正在使用Arquillian托管的Tomcat 7容器.使用arquillian.xml中的javaVmArguments属性指定Xmx值:

<?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>

对托管Tomcat 7容器支持的属性的完整引用位于Arquillian Confluence wiki中.

标签:linux,testing,heap-memory,tomcat7,jboss-arquillian
来源: https://codeday.me/bug/20190620/1248248.html