如何解决Heroku中的H14错误?

时间:2018-03-10 07:11:34

标签: maven spring-mvc heroku

我正在尝试使用heroku中的spring boot app usng maven插件部署war文件。

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

  

2018-03-10T05:47:07.563714 + 00:00 heroku [router]:at = error code = H14   desc =“没有正在运行的Web进程”方法= GET path =“/ favicon.ico”   主机= patiyati.herokuapp.com   request_id = ebb35d7d-1fff-484f-8f58-faccd506b002 fwd =“171.76.43.17”   dyno = connect = service = status = 503 bytes = protocol = 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 [router]:at = error code = H10   desc =“App crashed”method = GET path =“/ favicon.ico”   主机= patiyati.herokuapp.com   request_id = 59d88594-c17f-4003-8527-722d780f475c fwd =“171.76.43.17”   dyno = connect = service = status = 503 bytes = protocol = https

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

2 个答案:

答案 0 :(得分:1)

使用以下条目在应用程序根目录中添加Procfile,然后推送应用程序。

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

修改

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

答案 1 :(得分:0)

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