3

I can't open my app in Heroku - I get error H10. When I run my app in Eclipse or use executable jar file - everything work well. Here is my code : GITHub Below is my log file: DropBox

Marcin
  • 33
  • 1
  • 6

2 Answers2

4

You app is running on port 8080, but on Heroku it needs to bind to the environment variable $PORT. You can fix Spring to do this by adding the following to your application.properties:

server.port=${PORT:8080}

This will use $PORT if it's set, and default to 8080 if it's not.

codefinger
  • 10,088
  • 7
  • 39
  • 51
  • Thank you very much for your advise. When I added 'server.port=${PORT:8080}' everything work well – Marcin Jan 19 '18 at 15:14
  • Hello. Would you be so kind to take a look at my question on Heroku? https://stackoverflow.com/questions/48725299/heroku-the-simplest-application-could-not-find-or-load-main-class-com-web-some. No one else seems to be able to help. – parsecer Feb 10 '18 at 20:44
0

I solved this error using Procfile, the Procfile is always a simple text file that is named Procfile without a file extension, For example, Procfile.txt is not valid, The Procfile must live in your app’s root directory. It does not function if placed anywhere else.

What to write in Procfile?

  web: java -jar build/libs/your-project-name-version.jar 

the version you can find inside build.gradle/pom.xml

Example:- web: java -jar build/libs/khatabook-1.0.jar

Where to create Procfile?

I have given my project structure image link for [1]: https://i.stack.imgur.com/tsB35.png

My gradle file link https://github.com/himanshujainpro/khatabook/blob/master/build.gradle

My application.properties https://github.com/himanshujainpro/khatabook/blob/master/src/main/resources/application.properties

Project link for further reference https://github.com/himanshujainpro/khatabook

Himanshu Jain
  • 191
  • 1
  • 4