命令“mvn package”失败,状态为137

时间:2011-07-21 09:09:13

标签: java gwt maven

使用“mvn package”打包GWT项目失败,我有以下输出:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building MyProject
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [apt:process {execution: default}]
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [aspectj:test-compile {execution: default}]
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Not compiling test sources
[INFO] [surefire:test {execution: default-test}]
[INFO] Tests are skipped.
[INFO] [gwt:compile {execution: gwtcompile}]
[INFO] Compiling module com.MyProject
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Command [[
/bin/sh -c /usr/lib/jvm/java-6-sun-1.6.0.24/jre/bin/java -XX:MaxPermSize=256M -Xmx512M -classpath /home/projects/MyProject/trunk/src/main/java:/home/projects/MyProject/trunk/target/generated-sources/java:/home/projects/MyProject/trunk/src/main/aspect:/home/projects/MyProject/trunk/src/main/resources:/home/projects/MyProject/trunk/src/main/webapp/WEB-INF/classes:/root/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar:/root/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar:/root/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar:/root/.m2/repository/org/slf4j/jul-to-slf4j/1.6.1/jul-to-slf4j-1.6.1.jar:/root/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar:/root/.m2/repository/org/aspectj/aspectjrt/1.6.11.M1/aspectjrt-1.6.11.M1.jar:/root/.m2/repository/org/aspectj/aspectjweaver/1.6.11.M1/aspectjweaver-1.6.11.M1.jar:/root/.m2/repository/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar:/root/.m2/repository/net/sf/flexjson/flexjson/2.0/flexjson-2.0.jar:/root/.m2/repository/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar:/root/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/root/.m2/repository/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-aspects/3.0.5.RELEASE/spring-aspects-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-context-support/3.0.5.RELEASE/spring-context-support-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-tx/3.0.5.RELEASE/spring-tx-3.0.5.RELEASE.jar:/root/.m2/repository/com/h2database/h2/1.3.148/h2-1.3.148.jar:/root/.m2/repository/mysql/mysql-connector-java/5.1.13/mysql-connector-java-5.1.13.jar:/root/.m2/repository/org/hibernate/hibernate-core/3.6.0.Final/hibernate-core-3.6.0.Final.jar:/root/.m2/repository/antlr/antlr/2.7.6/antlr-2.7.6.jar:/root/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar:/root/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/root/.m2/repository/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar:/root/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar:/root/.m2/repository/javax/transaction/jta/1.1/jta-1.1.jar:/root/.m2/repository/org/hibernate/hibernate-entitymanager/3.6.0.Final/hibernate-entitymanager-3.6.0.Final.jar:/root/.m2/repository/javassist/javassist/3.12.0.GA/javassist-3.12.0.GA.jar:/root/.m2/repository/org/hibernate/hibernate-validator/4.1.0.Final/hibernate-validator-4.1.0.Final.jar:/root/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar:/root/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA-sources.jar:/root/.m2/repository/cglib/cglib-nodep/2.2/cglib-nodep-2.2.jar:/root/.m2/repository/org/springframework/spring-jdbc/3.0.5.RELEASE/spring-jdbc-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-orm/3.0.5.RELEASE/spring-orm-3.0.5.RELEASE.jar:/root/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar:/root/.m2/repository/commons-dbcp/commons-dbcp/1.3/commons-dbcp-1.3.jar:/root/.m2/repository/org/springframework/spring-web/3.0.5.RELEASE/spring-web-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar:/root/.m2/repository/org/springframework/webflow/spring-js-resources/2.2.1.RELEASE/spring-js-resources-2.2.1.RELEASE.jar:/root/.m2/repository/commons-digester/commons-digester/2.0/commons-digester-2.0.jar:/root/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar:/root/.m2/repository/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar:/root/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar:/root/.m2/repository/javax/el/el-api/1.0/el-api-1.0.jar:/root/.m2/repository/joda-time/joda-time/1.6/joda-time-1.6.jar:/root/.m2/repository/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar:/root/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar:/root/.m2/repository/com/sun/jersey/jersey-client/1.5/jersey-client-1.5.jar:/root/.m2/repository/com/sun/jersey/jersey-core/1.5/jersey-core-1.5.jar:/root/.m2/repository/org/json/json/20090211/json-20090211.jar:/root/.m2/repository/javax/ws/rs/jsr311-api/1.1.1/jsr311-api-1.1.1.jar:/home/projects/MyProject/trunk/lib/gwt-incubator.jar:/root/.m2/repository/com/google/gwt/inject/gin/1.5.0/gin-1.5.0.jar:/root/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar:/root/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/root/.m2/repository/com/google/inject/extensions/guice-assistedinject/3.0/guice-assistedinject-3.0.jar:/root/.m2/repository/xalan/xalan/2.7.1/xalan-2.7.1.jar:/root/.m2/repository/xalan/serializer/2.7.1/serializer-2.7.1.jar:/root/.m2/repository/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar:/root/.m2/repository/com/mysema/querydsl/querydsl-apt/2.1.2/querydsl-apt-2.1.2.jar:/root/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar:/root/.m2/repository/com/mysema/querydsl/querydsl-core/2.1.2/querydsl-core-2.1.2.jar:/root/.m2/repository/net/sourceforge/collections/collections-generic/4.01/collections-generic-4.01.jar:/root/.m2/repository/commons-lang/commons-lang/2.4/commons-lang-2.4.jar:/root/.m2/repository/com/mysema/commons/mysema-commons-lang/0.2.1/mysema-commons-lang-0.2.1.jar:/root/.m2/repository/com/mysema/codegen/codegen/0.3.1/codegen-0.3.1.jar:/root/.m2/repository/net/sourceforge/findbugs/jsr305/1.3.2/jsr305-1.3.2.jar:/root/.m2/repository/net/sourceforge/findbugs/annotations/1.3.2/annotations-1.3.2.jar:/root/.m2/repository/com/mysema/querydsl/querydsl-jpa/2.1.2/querydsl-jpa-2.1.2.jar:/root/.m2/repository/cglib/cglib/2.2/cglib-2.2.jar:/root/.m2/repository/asm/asm/3.1/asm-3.1.jar:/root/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/root/.m2/repository/javax/mail/mail/1.4.4/mail-1.4.4.jar:/root/.m2/repository/org/mindrot/jbcrypt/0.3m/jbcrypt-0.3m.jar:/root/.m2/repository/com/google/gwt/gwt-user/2.3.0/gwt-user-2.3.0.jar:/root/.m2/repository/com/google/gwt/gwt-dev/2.3.0/gwt-dev-2.3.0.jar com.google.gwt.dev.Compiler -gen /home/projects/MyProject/trunk/target/.generated -logLevel INFO -style OBF -war /home/projects/MyProject/trunk/target/MyProject-0.1.0.BUILD-SNAPSHOT -localWorkers 1 com.MyProject
]] failed with status 137}
  • Machine is Debian 6.0
  • java版“1.6.0_24”,Java(TM)SE运行时环境(版本1.6.0_24-b07),Java HotSpot(TM)64位服务器VM(版本19.1-b02,混合模式)
  • maven编译器插件摘自pom.xml: 1.6 1.6

有没有人遇到同样的问题?非常感谢你提前。

4 个答案:

答案 0 :(得分:22)

我能够通过向系统添加交换文件来解决这个问题(根本没有交换)。

有关该问题原因的详细信息,请here

这是关键片段:

  

在这种情况下,问题是Linux内核耗尽虚拟   记忆。内核OOM(内存不足)杀手然后介入   杀死了大多数(非)值得的受害者/失控过程   是GWT / maven构建过程。

     

要确定是否是这种情况,您可以使用{{dmesg}}命令   来自linux shell。在输出结束的某个地方会有   是一个类似于

的行      

{code}内存不足:杀死进程946(守护进程)得分1073527或者a   孩子{code}

     

作为参考,状态代码137(128 + 9)通常表示(可以   unix的味道不同)。该过程终止了   收到信号。在这种情况下,信号9是SIGKILL和   不可阻挡的杀戮。

     

如果是这种情况,底层机器/ OS需要更多虚拟   记忆。这可以通过添加物理内存或交换来添加   适当的空间。

答案 1 :(得分:2)

对我来说,我发现问题是分配的内存太多,而不是太少。

在具有2GB内存并将最大堆大小设置为2GB的计算机上运行作业时,构建最终失败,状态为137.但是,当将作业设置为最大1GB(例如-Xmx1g -Xms512m)时,构建成功了。

这种方式很有意义,因为JVM可以自由地将其内存增加到最大堆大小,但如果实际内存不足,操作系统将终止进程。但是,如果你减少最大堆大小,JVM不会试图增加它的内存,所以操作系统不会担心它足以杀死它。

此外,我正在使用GWT,它需要一个单独的编译过程,并且参数必须在extraJvmArgs配置中指定为gwt-maven-plugin元素,而不是MAVEN_OPTS

答案 2 :(得分:0)

尝试另一个JDK / JRE版本(或全新安装)。看起来java可执行文件在运行GWT编译器时崩溃了。您还可以尝试将其编译为另一台计算机以确认问题与JDK / JRE安装有关。

答案 3 :(得分:0)

我遇到了这个问题,我的系统管理员在Bamboo服务器上发现了许多挂起的进程。清除这些流程解决了这个问题。它可能与您自己的构建没有直接关系。