无法启动 Glassfish 3.1:java.io.IOException:error=12,无法分配内存
我刚刚从 A2Hosting 购买了 ubuntu 9.0.4 VPS(256 MB 专用 RAM(512 MB Burstable)),并尝试在其上安装 Glassfish 服务器。当我尝试 asadmin start-domain
时,出现此错误
JVM failed to start: java.io.IOException: Cannot run program "/usr/local/jdk1.6.0_22/bin/java"
(in directory "/home/harry/glassfish3/glassfish/domains/domain1/config"):
java.io.IOException: error=12, Cannot allocate memory
Command start-domain failed.
这是 free
命令的结果。
total used free shared buffers cached
Mem: 524288 148552 375736 0 0 0
-/+ buffers/cache: 148552 375736
Swap: 0 0 0
编辑 包含 domain.xml
<java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix="">
<jvm-options>-XX:MaxPermSize=192m</jvm-options>
<jvm-options>-server</jvm-options>
<jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
<jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
<jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
<jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
<jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
<jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
<jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
<jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
<jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
<jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
<jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-Xmx512m</jvm-options>
<!-- Port on which remote shell listens for connections.-->
<jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options>
<!-- How many concurrent users can connect to this remote shell -->
<jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
<!-- From which hosts users can connect -->
<jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
<!-- Directory being watched by fileinstall. -->
<jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
<!-- Time period fileinstaller thread in ms. -->
<jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
<!-- log level: 1 for error, 2 for warning, 3 for info and 4 for debug. -->
<jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options>
<!-- should new bundles be started or installed only?
true => start, false => only install
-->
<jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
<!-- should watched bundles be started transiently or persistently -->
<jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
<!-- End of OSGi bundle configurations -->
</java-config>
I just purchase a ubuntu 9.0.4 VPS (256 MB Dedicated RAM (512 MB Burstable)) from A2Hosting and try to throw a Glassfish server on it. When I try asadmin start-domain
I got this error
JVM failed to start: java.io.IOException: Cannot run program "/usr/local/jdk1.6.0_22/bin/java"
(in directory "/home/harry/glassfish3/glassfish/domains/domain1/config"):
java.io.IOException: error=12, Cannot allocate memory
Command start-domain failed.
Here is the result of the free
command.
total used free shared buffers cached
Mem: 524288 148552 375736 0 0 0
-/+ buffers/cache: 148552 375736
Swap: 0 0 0
EDIT
contain of domain.xml
<java-config debug-options="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=${JAVA_DEBUGGER_PORT}" system-classpath="" classpath-suffix="">
<jvm-options>-XX:MaxPermSize=192m</jvm-options>
<jvm-options>-server</jvm-options>
<jvm-options>-XX:+UnlockDiagnosticVMOptions</jvm-options>
<jvm-options>-Djava.endorsed.dirs=${com.sun.aas.installRoot}/modules/endorsed${path.separator}${com.sun.aas.installRoot}/lib/endorsed</jvm-options>
<jvm-options>-Djava.security.policy=${com.sun.aas.instanceRoot}/config/server.policy</jvm-options>
<jvm-options>-Djava.security.auth.login.config=${com.sun.aas.instanceRoot}/config/login.conf</jvm-options>
<jvm-options>-Dcom.sun.enterprise.security.httpsOutboundKeyAlias=s1as</jvm-options>
<jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
<jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
<jvm-options>-Djava.ext.dirs=${com.sun.aas.javaRoot}/lib/ext${path.separator}${com.sun.aas.javaRoot}/jre/lib/ext${path.separator}${com.sun.aas.instanceRoot}/lib/ext</jvm-options>
<jvm-options>-Djdbc.drivers=org.apache.derby.jdbc.ClientDriver</jvm-options>
<jvm-options>-DANTLR_USE_DIRECT_CLASS_LOADING=true</jvm-options>
<jvm-options>-Dcom.sun.enterprise.config.config_environment_factory_class=com.sun.enterprise.config.serverbeans.AppserverConfigEnvironmentFactory</jvm-options>
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-Xmx512m</jvm-options>
<!-- Port on which remote shell listens for connections.-->
<jvm-options>-Dosgi.shell.telnet.port=${OSGI_SHELL_TELNET_PORT}</jvm-options>
<!-- How many concurrent users can connect to this remote shell -->
<jvm-options>-Dosgi.shell.telnet.maxconn=1</jvm-options>
<!-- From which hosts users can connect -->
<jvm-options>-Dosgi.shell.telnet.ip=127.0.0.1</jvm-options>
<!-- Directory being watched by fileinstall. -->
<jvm-options>-Dfelix.fileinstall.dir=${com.sun.aas.installRoot}/modules/autostart/</jvm-options>
<!-- Time period fileinstaller thread in ms. -->
<jvm-options>-Dfelix.fileinstall.poll=5000</jvm-options>
<!-- log level: 1 for error, 2 for warning, 3 for info and 4 for debug. -->
<jvm-options>-Dfelix.fileinstall.log.level=3</jvm-options>
<!-- should new bundles be started or installed only?
true => start, false => only install
-->
<jvm-options>-Dfelix.fileinstall.bundles.new.start=true</jvm-options>
<!-- should watched bundles be started transiently or persistently -->
<jvm-options>-Dfelix.fileinstall.bundles.startTransient=true</jvm-options>
<!-- End of OSGi bundle configurations -->
</java-config>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试减少 -Xmx512m 行中的数量,直到获得有效的结果。然后联系您的提供商并了解您的限制在哪里。
Try reducing the amount in the -Xmx512m line until you get something that works. Then contact your provider and see where your limits are at.