Heroku 错误 at=error code=H14 desc="No web processes running" method=GET path="/"

Posted

技术标签:

【中文标题】Heroku 错误 at=error code=H14 desc="No web processes running" method=GET path="/"【英文标题】:Heroku error at=error code=H14 desc="No web processes running" method=GET path="/" 【发布时间】:2021-10-10 22:45:39 【问题描述】:

我正在尝试使用 Heroku 部署我的 spring 项目,使用来自 Github 的部署。

我是 Spring 和 Heroku 的新手。

起初它给了我成功,但是当我尝试访问时返回此消息

at=error code=H14 desc="No web processes running" method=GET path="/" dyno= connect= service= status=503 bytes= protocol=https

我的 pom.xml:

<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/3.6.2 https://maven.apache.org/xsd/maven-3.6.2.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>br.edu.utfpr.sgcc</groupId>
    <artifactId>SGCC</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <build>
        <finalName>SGCC</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <verbose>true</verbose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>5.1.7.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.1.7.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet.jsp/javax.servlet.jsp-api -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>5.1.7.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>5.1.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.1.0.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>taglibs</groupId>
            <artifactId>standard</artifactId>
            <version>1.1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>5.4.3.Final</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>5.2.5.RELEASE</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.13</version>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>6.0.2.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator-annotation-processor</artifactId>
            <version>6.0.2.Final</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>2.3.4.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <version>2.5.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>2.4.2</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <version>2.5.3</version>
        </dependency>
    </dependencies>
</project>

我没有procfile,但不知道有没有必要

当我运行 heroku ps:scale web=1 我收到状态 127,但返回相同的错误

2021-08-06T00:36:36.163994+00:00 heroku[run.6184]:状态从开始变为向上 2021-08-06T00:36:36.419540+00:00 heroku[run.6184]:等待客户端 2021-08-06T00:36:36.463704+00:00 heroku[run.6184]:使用命令heroku ps:scale web=1启动进程 2021-08-06T00:36:38.857286+00:00 heroku[run.6184]:客户端连接关闭。向所有进程发送 SIGHUP 2021-08-06T00:36:39.385263+00:00 heroku[run.6184]:进程以状态 127 退出 2021-08-06T00:36:39.479070+00:00 heroku[run.6184]:状态从 up 变为 complete

【问题讨论】:

【参考方案1】:

“没有运行 Web 进程”的错误 H14 基本上意味着您没有运行任何 Web dyno。您可以使用heroku ps:scale web=1 启动一个。

更多详情请查看this question。

【讨论】:

我试过了,还是一样的错误,我用我得到的东西编辑了帖子【参考方案2】: 我在下面添加了代码,
gunicorn appn.wsgi

heroku ps:scale web=1 
web: gunicorn appn.wsgi --log-file -

Procfile 中仍然面临一个问题:

2022-01-19T15:35:19.020279+00:00 heroku[router]: 
at=error code=H14 desc="No web processes running" method=GET 
path="/" host=****.herokuapp.com request_id=eer2323423er32 fwd="125.16.01.197" 
dyno= connect= service= status=503 bytes= protocol=https
我花了一个晚上来解决这个问题, 但最后,我在另一个应用程序上部署了相同的代码,这次它运行良好:]

【讨论】:

以上是关于Heroku 错误 at=error code=H14 desc="No web processes running" method=GET path="/"的主要内容,如果未能解决你的问题,请参考以下文章

为啥我的 heroku node.js 应用程序给出 at=error code=H10 desc="App crashed" method=GET path="/&qu

由于 Error=H10,Flask App 在通过 Heroku 部署时导致应用程序错误

Heroku 最近开始在 Webpack 构建期间给出部署错误“npm ERR!code ELIFECYCLE”

at=错误代码=H10 desc="应用程序崩溃"方法=获取路径="/"

如何更改 Heroku 中的列类型?

Heroku CLI 登录失败并出现错误“错误:ENOENT:没有这样的文件或目录,打开 'H:/_netrc'”