错误代码=H10:无法将springboot应用部署到heroku
python 369
原文标题 :error code=H10: Unable to deploy springboot app to heroku
我对springboot真的很陌生,我构建了我的第一个rest API并想将它部署到heroku。但不幸的是heroku返回at=error code=H10 desc="App crashed" method=GET path="/"
错误。这是我的过程文件
web: java -jar target/Destadeals.0.0.1-SNAPSHOT.jar
这是 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>Destadeals</groupId>
<artifactId>Destadeals</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Destadeals</name>
<description>Desta deals project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>2021.0.0</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-common</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>com.sebastian-daschner</groupId>
<artifactId>jaxrs-analyzer</artifactId>
<version>0.17</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<destFileName>webapp-runner.jar</destFileName>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
application.properties
spring.datasource.url= jdbc:mysql://localhost:3306/desta_deals?allowPublicKeyRetrieval=true&useSSL=false
spring.datasource.username= root
spring.datasource.password= password
spring.jpa.properties.hibernate.dialect= org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.hibernate.ddl-auto= update
server.forward-headers-strategy=framework
# App Properties
bezkoder.app.jwtSecret= loginaccepted
bezkoder.app.jwtExpirationMs= 86400000
server.port=${PORT:8080}
spring.datasource.initialization-mode=always
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
springdoc.api-docs.path=/api-docs
springdoc.swagger-ui.path=/swagger-ui-custom.html
我试过以下procfile
web: java $JAVA_OPTS -Dserver.port=$PORT -jar target/Destadeals.0.0.1-SNAPSHOT.war
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/Destadeals.0.0.1-SNAPSHOT.jar
web: java -jar target/java-getting-started-1.0.jar
但以上 procfile 代码都没有为我工作。
我可以改变什么来将我的springboot应用程序部署到heroku?
谢谢