0

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
Sai Upadhyayula
  • 2,404
  • 3
  • 23
  • 35
  • possible duplicate of [How to deal with "java.lang.OutOfMemoryError: Java heap space" error (64MB heap size)](http://stackoverflow.com/questions/37335/how-to-deal-with-java-lang-outofmemoryerror-java-heap-space-error-64mb-heap) – gerrytan Mar 04 '15 at 22:04

1 Answers1

1

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.

codefinger
  • 10,088
  • 7
  • 39
  • 51