【发布时间】: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