在尝试将我的Spring MVC Application war文件部署到Heroku时,我收到了java.lang.OutofMemoryError Exception。这个例外可能是什么原因?我做错了什么?
C:\Users\sai\Desktop>heroku deploy:war --war crud-1.0.0-BUILD-SNAPSHOT.war --app springmvc-crud-jpa
Uploading crud-1.0.0-BUILD-SNAPSHOT.war....
---> Packaging application...
- app: springmvc-crud-jpa
- including: webapp-runner.jar
- including: crud-1.0.0-BUILD-SNAPSHOT.war
- installing: OpenJDK 1.8
---> Creating slug...
- file: slug.tgz
- size: 68MB
---> Uploading slug... Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.io.ByteArrayOutputStream.grow(Unknown Source)
at java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source)
at java.io.ByteArrayOutputStream.write(Unknown Source)
at sun.net.www.http.PosterOutputStream.write(Unknown Source)
at com.heroku.sdk.deploy.Curl.put(Curl.java:75)
at com.heroku.sdk.deploy.Slug.upload(Slug.java:81)
at com.heroku.sdk.deploy.App.uploadSlug(App.java:196)
at com.heroku.sdk.deploy.App.deploySlug(App.java:186)
at com.heroku.sdk.deploy.App.createAndReleaseSlug(App.java:169)
at com.heroku.sdk.deploy.App.deploy(App.java:83)
at com.heroku.sdk.deploy.App.deploy(App.java:87)
at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:32)
at com.heroku.sdk.deploy.DeployWar.main(DeployWar.java:51)
---> Done
答案 0 :(得分:1)
我是heroku-deploy插件的维护者。我已经增加了该工具的默认堆大小,因此如果您通过运行heroku plugins:install https://github.com/heroku/heroku-deploy
重新安装它然后再次部署,它将有希望工作。
如果其他人继续遇到这种情况,您可以通过将JAVA_TOOL_OPTIONS
环境变量设置为-Xmx2g
来手动增加堆大小。