我在Heroku上传了JavaServlet项目。当我在浏览器上检查它时,它显示“应用程序错误”并且没有运行。
根据Heroku上的构建日志,似乎我的项目已正确构建和部署。
-----> Gradle app detected
-----> Installing OpenJDK 1.8... done
-----> Building Gradle app...
-----> executing ./gradlew stage
:clean UP-TO-DATE
:copyToLib
:compileJava
:processResources NO-SOURCE
:classes
:war
:stage
BUILD SUCCESSFUL in 15s
4 actionable tasks: 3 executed, 1 up-to-date
-----> Discovering process types
Procfile declares types -> web
-----> Compressing...
Done: 76.5M
-----> Launching...
Released v3
https://rocky-sands-26639.herokuapp.com/ deployed to Heroku
我使用以下命令检查了运行时日志:
$heroku logs
然后我得到了以下错误日志。如何解决此错误?
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
我提到了这个页面。我用gradle而不是maven。 https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#using-webapp-runner-to-deploy-war-files
答案 0 :(得分:0)
您需要将--port $PORT
添加到Procfile
。它应该是这样的:
web: java -jar build/server/webapp-runner-*.jar --port $PORT build/libs/*.war