【问题标题】:How to solve H14 error in Heroku?如何解决 Heroku 中的 H14 错误?
【发布时间】:2018-08-18 18:29:26
【问题描述】:

我正在尝试使用 heroku 中的 spring boot 应用程序使用 maven 插件部署战争文件。

我在部署它时遇到的错误代码是:

2018-03-10T05:47:07.563714+00:00 heroku[路由器]: at=error code=H14 desc="没有运行网络进程" method=GET path="/favicon.ico" 主机=patiyati.herokuapp.com request_id=ebb35d7d-1fff-484f-8f58-faccd506b002 fwd="171.76.43.17" dyno=连接=服务=状态=503字节=协议=https

我的pom.xml如下图:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <artifactId>Patiyati</artifactId>
    <packaging>war</packaging>
    <name>Patiyati</name>
    <description>Patiyati</description>
    <version>1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <!-- Web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- Web with Tomcat + Embed -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- JSTL -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>

        <!-- Need this to compile JSP -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Need this to compile JSP -->
        <dependency>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
            <version>4.6.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- Optional, for bootstrap -->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180130</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <!-- Package as an executable jar/war -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>2.0.3</version>
                <configuration>
                    <appName>patiyati</appName>
                    <warFile>target/Patiyati-1.0.war</warFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我已经经历了许多类似的问题,并尝试实施这些问题,但没有一个有用... 关于使用 Heroku ps:scale web=1 -a patiyati 我收到“找不到进程类型错误”

我按照文档heroku deployment using maven plugin 中给出的步骤进行操作,但它提供了相同的结果。

关于添加 procfile :

web: java $JAVA_OPTS -cp target/classes:target/dependency/* com.spring.app.SpringBootWebApplication

SpringBootWebApplication 是我的主类,在 com.spring.app 包下。

现在我的应用程序崩溃了

2018-03-10T08:31:39.460117+00:00 heroku[路由器]: at=error code=H10 desc="应用程序崩溃" 方法=GET path="/favicon.ico" 主机=patiyati.herokuapp.com request_id=59d88594-c17f-4003-8527-722d780f475c fwd="171.76.43.17" dyno=连接=服务=状态=503字节=协议=https

如果有人能帮我解决这个问题,那就太好了。 提前致谢。

【问题讨论】:

  • 您是否尝试过从 Heroku 仪表板放大测功机?
  • 我确实查看了仪表板,但我无法添加它...在资源选项卡下它显示:这个应用程序还没有进程类型向您的应用程序添加一个 Procfile 以定义其进程类型。
  • 检查我的答案。刚刚注意到你的pom.xml。您将应用程序部署为 war 而不是 jar 是否有特定原因?
  • 是的,这是要求之一

标签: maven spring-mvc heroku


【解决方案1】:

在您的应用程序根目录中添加一个 Procfile 并使用以下条目推送应用程序。

web: java -jar $JAVA_OPTS -Dserver.port=$PORT target/your-app-name-version.jar

编辑

刚刚从您的pom.xml 了解到您正在包装为war。请参考here 上的war 部署到heroku。

【讨论】:

  • 我已经浏览过同一个文档..它再次重定向到 maven 插件部署文档。
  • 你试过heroku-cli路由heroku war:deploy &lt;path_to_war_file&gt; --app &lt;app_name&gt;吗?
  • 给我一分钟我也试试
  • 您是否首先安装了插件? heroku plugins:install heroku-cli-deploy
  • 是的......它已经安装......但是是的,我发现了那里的错误......我在战争之间有空间:因此部署错误
【解决方案2】:

我有同样的问题。我从 pom.xml 中删除了 &lt;packaging&gt;war&lt;/packaging&gt; 行,然后推送并开始工作。我希望它可以帮助某人

【讨论】:

    猜你喜欢
    • 2020-12-27
    • 1970-01-01
    • 2020-02-05
    • 1970-01-01
    • 2016-08-04
    • 2020-06-19
    • 2022-07-14
    • 2017-06-07
    • 2012-04-15
    相关资源
    最近更新 更多