简体   繁体   English

无法部署到 Heroku。 at=错误代码=H10 desc=“应用程序崩溃”

[英]Can't deploy to Heroku. at=error code=H10 desc=“App crashed”

I'm trying to deploy my app to Heroku.我正在尝试将我的应用程序部署到 Heroku。 And my app is crashed.我的应用程序崩溃了。 This is errors:这是错误:

at=error code=H10 desc="App crashed" method=GET path="/" 
host=smartmed2017.herokuapp.com request_id=3e8cc17e-320b-4230-bdbb-
3a751e3477de fwd="195.19.247.73" dyno= connect= service= status=503 
bytes= protocol=https

2017-06-01T11:17:42.380548+00:00 heroku[router]: at=error code=H10 
desc="App crashed" method=GET path="/favicon.ico" 
host=smartmed2017.herokuapp.com request_id=9ab6574e-3fed-4af3-9cae-
0651e13d9112 fwd="195.19.247.73" dyno= connect= service= status=503 
bytes= protocol=https

As usual, but I the reasons of this problem can be different.像往常一样,但我这个问题的原因可能有所不同。

This is Main.class这是 Main.class

@Controller
@SpringBootApplication
public class Main
{
    public static void main(String[] args) throws Exception {
        SpringApplication.run(Main.class, args);
    }

    @RequestMapping("/")
    String index() {
        return "index";
    }
}

Procfile:简介:

web: java -Dserver.port=$PORT -jar target/untitled-1.0-SNAPSHOT.jar

Screenshot of my classes and pages here我的课程和页面的屏幕截图在这里

H10 error means : A crashed web dyno or a boot timeout on the web dyno will present this error. H10 错误意味着:Web dyno 崩溃或 Web dyno 上的启动超时将显示此错误。 According to java-webapp-runner根据java-webapp-runner

  1. Add webapp runner to the plugins section in your pom.xml将 webapp runner 添加到 pom.xml 的 plugins 部分

     <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.3</version> <executions> <execution> <phase>package</phase> <goals><goal>copy</goal></goals> <configuration> <artifactItems> <artifactItem> <groupId>com.github.jsimone</groupId> <artifactId>webapp-runner</artifactId> <version>8.5.11.3</version> <destFileName>webapp-runner.jar</destFileName> </artifactItem> </artifactItems> </configuration> </execution> </executions> </plugin>
  2. Change your Procfile to将您的 Procfile 更改为

web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

Then try and redeploy.然后尝试重新部署。

Check out this project i deployed on github if it can help you more Sample Project on Heroku .查看我在 github 上部署的这个项目,如果它可以帮助您在 Heroku 上获得更多示例项目

Can you share the project on github?可以分享github上的项目吗?

After creating the " Procfile " inside of the root folder and setting below code on it, the server started working:在根文件夹中创建“ Procfile ”并在其上设置以下代码后,服务器开始工作:

web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/my-nice-app-0.0.1-SNAPSHOT.jar

Just make sure that:只要确保:

  1. ./gradlew build works ./gradlew 构建工作
  2. ./gradlew bootRun works ./gradlew bootRun有效

Documentation: https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#prerequisites文档: https : //devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#prerequisites

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM