我在 Heroku 上部署了一個(gè)帶有 Spark 框架的應(yīng)用程序。它在 Heroku 上成功構(gòu)建并啟動(dòng)了服務(wù)器,但是當(dāng)我嘗試從服務(wù)器獲取響應(yīng)時(shí),我收到 HTTP 503,并且在我的日志中收到以下 H14 錯(cuò)誤:2019-03-10T17:52:44.983359+00:00 heroku[servergossip.1]: Restarting2019-03-10T17:52:45.299269+00:00 heroku[servergossip.1]: State changed from up to starting2019-03-10T17:52:46.338372+00:00 heroku[servergossip.1]: Stopping all processes with SIGTERM2019-03-10T17:52:46.000000+00:00 app[api]: Build succeeded2019-03-10T17:52:46.769383+00:00 heroku[servergossip.1]: Process exited with status 1432019-03-10T17:52:48.416183+00:00 heroku[servergossip.1]: Starting process with command `java $JAVA_OPTS -cp target/classes:target/dependency/* Main --port 37274`2019-03-10T17:52:49.054556+00:00 heroku[servergossip.1]: State changed from starting to up2019-03-10T17:52:51.513243+00:00 app[servergossip.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8...2019-03-10T17:52:52.672327+00:00 app[servergossip.1]: INFO: Started ServerConnector@3ee6bd4d{HTTP/1.1}{0.0.0.0:37274}2019-03-10T17:53:09.078587+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/bot" host=servergossip.herokuapp.com request_id=45e0301a-3c82-495e-830d-2db0b0d1f9ef fwd="87.240.189.18" dyno= connect= service= status=503 bytes= protocol=https我的Procfile文件:servergossip: java $JAVA_OPTS -cp target/classes:target/dependency/* Main --port $PORTSpark 示例中的代碼:public class Main { private static final Logger LOG = LoggerFactory.getLogger(Main.class); public static void main(String[] args) { port(getHerokuAssignedPort()); get("/bot", (req, res) -> { return "hi"; }); } static int getHerokuAssignedPort() { ProcessBuilder processBuilder = new ProcessBuilder(); if (processBuilder.environment().get("PORT") != null) { return Integer.parseInt(processBuilder.environment().get("PORT")); } return 4567; }}我使用了類似的命令heroku:scale *someproject* = 1,但沒有任何反應(yīng)。所以有什么問題?
添加回答
舉報(bào)
0/150
提交
取消