简体   繁体   中英

Heroku error code H10 when Spring Boot app is deployed

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

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.

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

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