Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Webapp部署到Heroku-错误>;错误R10(启动超时)_Java_Heroku_Jersey_Jetty - Fatal编程技术网

Java Webapp部署到Heroku-错误>;错误R10(启动超时)

Java Webapp部署到Heroku-错误>;错误R10(启动超时),java,heroku,jersey,jetty,Java,Heroku,Jersey,Jetty,我在将我的webapp部署到Heroku平台时遇到问题,因为我无法对webapp进行REST调用 我已经查看了日志,返回了以下内容: 2019-04-22T17:58:53.942100+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch 2019-04-22T17:58:53.942570+00:00 heroku[

我在将我的webapp部署到Heroku平台时遇到问题,因为我无法对webapp进行REST调用
我已经查看了日志,返回了以下内容:

2019-04-22T17:58:53.942100+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 90 seconds of launch
2019-04-22T17:58:53.942570+00:00 heroku[web.1]: Stopping process with SIGKILL
2019-04-22T17:58:54.082855+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-22T17:58:54.062137+00:00 heroku[web.1]: Process exited with status 137
我对这个错误做了一些研究,并实现了不同的解决方案()来解决这个问题,但无法做到这一点。我已经看到一些决议声明将0.0.0.0实现为主机,但是在我的代码中,我没有使用任何主机,如果我应该的话,我不知道在哪里实现

Main.java

public static void main(String[] args) throws Exception{
        // The port that we should run on can be set into an environment variable
        // Look for that variable and default to 8080 if it isn't there.
        String webPort = System.getenv("PORT");
        if (webPort == null || webPort.isEmpty()) {
            webPort = "8080";
        }

        System.out.println("Webport in use: " + webPort);

        final Server server = new Server(Integer.valueOf(webPort));
        final WebAppContext root = new WebAppContext();

        root.setContextPath("/");
        // Parent loader priority is a class loader setting that Jetty accepts.
        // By default Jetty will behave like most web containers in that it will
        // allow your application to replace non-server libraries that are part of the
        // container. Setting parent loader priority to true changes this behavior.
        // Read more here: http://wiki.eclipse.org/Jetty/Reference/Jetty_Classloading
        root.setParentLoaderPriority(true);

        final String webappDirLocation = "src/main/webapp/";
        root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
        root.setResourceBase(webappDirLocation);

        server.setHandler(root);

        server.start();
        server.join();
    }
程序文件-

web: java $JAVA_OPTS -Dserver.port=$PORT -cp target/classes:target/dependency/* com.example.heroku.Main
在日志中也发现了这一点:

2019-04-22T17:57:23.846721+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -Dserver.port=48973 -cp target/classes:target/dependency/* com.example.heroku.Main`
我一直在跟踪
感谢您的帮助