【问题标题】:Failed to start Glassfish after increasing heap size增加堆大小后无法启动 Glassfish
【发布时间】:2011-10-12 08:22:03
【问题描述】:

我想增加 Glassfish 的堆大小。为此,我知道我最多可以达到 4GB:

java -Xmx4000M -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03-384-10M3425)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-384, mixed mode)

我尝试在 domain.xml 文件中将 -Xmx 设置为 2GB:

<jvm-options>-Xmx2000m</jvm-options>

但我收到以下错误:

asadmin> start-domain
Waiting for ... to start .Error starting domain ...
The server exited prematurely with exit code 1.
Before it died, it produced the following output:

Error occurred during initialization of VM
The size of the object heap + VM data exceeds the maximum representable size
launchctl bsexec failed: Inappropriate ioctl for device

使用 -v 选项启动命令会给出:

12 oct. 2011 11:46:34 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: JVM invocation command line:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java
-XX:+UnlockDiagnosticVMOptions
-XX:MaxPermSize=512m
-XX:NewRatio=2
-XX:+CMSClassUnloadingEnabled
-Xmx2000m
-Xms1000m
...
12 oct. 2011 11:46:35 com.sun.enterprise.admin.launcher.GFLauncherLogger info
INFO: Successfully launched in 45 msec.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
Command start-domain failed.

【问题讨论】:

    标签: jvm glassfish heap-size


    【解决方案1】:

    我发现了问题。由于某些我不明白的原因,命令中传递了“-d32”参数,要求以 32 位模式启动。添加时

    <jvm-options>-d64</jvm-options>
    

    到 domain.xml 文件,glassfish 启动。请注意,文件中默认不存在此选项。

    【讨论】:

      【解决方案2】:

      在执行“-version”时,您必须在 GlassFish 中使用不同的 Java 安装。我可以使用 Mac OS 路径中的默认“java”重现相同的错误,但在使用绝对路径时不能:

      % /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xmx2300m -version
      java version "1.6.0_26"
      Java(TM) SE Runtime Environment (build 1.6.0_26-b03-383-11A511)
      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02-383, mixed mode)
      % java -Xmx2300m -version
      Error occurred during initialization of VM
      Could not reserve enough space for object heap
      Could not create the Java virtual machine.
      

      【讨论】:

        【解决方案3】:

        可能是您的系统上没有足够的磁盘空间吗?保留 4GB 的 RAM 可能需要 MAC OS 来扩展交换空间,而您可能没有磁盘空间来执行此操作。不幸的是,这曾经让我很伤心:-/

        【讨论】:

          猜你喜欢
          • 2016-06-18
          • 2012-09-20
          • 2019-03-05
          • 2015-02-21
          • 2012-06-17
          • 2013-02-16
          • 2016-02-13
          • 2012-06-16
          • 2014-02-06
          相关资源
          最近更新 更多