简体   繁体   中英

java.lang.OutOfMemoryError while deploying the war file in Heroku

While trying to deploy my Spring MVC Application war file to Heroku I am getting java.lang.OutofMemoryError Exception. What may be the reason for this exception? What am I doing wrong?

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

I'm the maintainer of the heroku-deploy plugin. I've increased the default heap size for the tool, so if you reinstall it by running heroku plugins:install https://github.com/heroku/heroku-deploy and then deploy again, it will hopefully work.

If other continue to encounter this, you can manually increase the heap size even further by setting the JAVA_TOOL_OPTIONS environment variable with something like -Xmx2g .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM