无法启动云代工码头app

时间:2012-06-24 20:11:29

标签: cloudfoundry

我正在尝试在云代工厂上启动一个jetty runner应用程序。代码是

https://github.com/simbo1905/ZkToDo2

可以使用

在本地启动
java -Djetty.host=localhost -Djetty.port=8080 -DDATABASE_URL=jdbc:postgresql://postgres:postgres@localhost/postgres -jar jetty-runner-jmx.jar zktodo2.war

所以我用

创建了一个postgresql
vmc create-service postgresql pgsql
压缩jar并将其打成拉链然后尝试部署到云代工厂时它会给我一个内存不足的错误。是什么赋予了?

simbo$ vmc push zktodo2 --path=cf.zip 
Detected a Standalone Application, is this correct? [Yn]: Y
1: java
2: node
3: node06
4: ruby18
5: ruby19
Select Runtime [java]: \1
Selected java
Start Command: java -Djetty.host=${VCAP_APP_HOST} -Djetty.port=${VCAP_APP_PORT} -DDATABASE_URL=jdbc:postgresql://postgres:postgres@localhost/postgres -jar jetty-runner-jmx.jar zktodo2.war
Application Deployed URL [None]: 
Memory reservation (128M, 256M, 512M, 1G, 2G) [512M]: 1G
How many instances? [1]: 
Bind existing services to 'zktodo2'? [yN]: y
1: pgsql
Which one?: 1
Create services to bind to 'zktodo2'? [yN]: 
Would you like to save this configuration? [yN]: y
Manifest written to manifest.yml.
Creating Application: OK
Binding Service [pgsql]: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (0K): OK   
Push Status: OK
Staging Application 'zktodo2': OK                                               
Starting Application 'zktodo2': .
Error: Application [zktodo2] failed to start, logs information below.

====> /logs/stderr.log <====

Could not create the Java virtual machine.

====> /logs/stdout.log <====

  Error occurred during initialization of VM
  Could not reserve enough space for object heap


  Delete the application? [Yn]: 

是什么给出了?

2 个答案:

答案 0 :(得分:2)

Cloud Foundry将所选内存分配的-Xmx设置添加到JAVA_OPTS env变量中,您需要将其包含在start命令中(java $ JAVA_OPTS -Djetty ....)。或者,您可以在启动命令中包含-Xmx。

答案 1 :(得分:1)

我确实部署了ZkToDo2 on cloudfoundry和一个码头跑者。 这是我使用的启动命令:

java -Djava.io.tmpdir=. -Dorg.apache.jasper.compiler.disablejsr199=true -Xmx512M -jar jetty-runner-jmx.jar --port ${VCAP_APP_PORT} zktodo2.war

为了使DATABASE_URL与cloudfoundry配置的postgresql数据库的连接参数匹配,我不得不对该应用程序进行一些小的修改。

这是pull request