2011-10-12 75 views
6

我想增加Glassfish的堆大小。對於這一點,我知道,我可以去高達4GB:增加堆大小後無法啓動Glassfish

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. 

回答

12

我發現了這個問題。由於某些我不明白的原因,在命令中傳遞了「-d32」參數,要求以32位模式啓動。當向domain.xml文件添加

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

時,glassfish啓動。請注意,該選項在文件中默認不存在。

0

在GlassFish中執行「-version」時,您必須使用不同的Java安裝。我可以重現使用默認的「java」同樣的錯誤在Mac OS中」路徑,但使用絕對路徑時,不能:

% /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. 
0

難道你沒有你的系統上有足夠的磁盤空間?保留4GB的RAM可能需要MAC OS擴展交換空間,並且您可能沒有磁盤空間來執行此操作。不幸的是,這已燒我之前: -/