![](/img/trans.png)
[英]Heroku: at=error code=H10 desc="App crashed" method=GET path="/"
[英]Can't deploy to Heroku. at=error code=H10 desc=“App crashed”
我正在尝试将我的应用程序部署到 Heroku。 我的应用程序崩溃了。 这是错误:
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
像往常一样,但我这个问题的原因可能有所不同。
这是 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";
}
}
简介:
web: java -Dserver.port=$PORT -jar target/untitled-1.0-SNAPSHOT.jar
H10 错误意味着:Web dyno 崩溃或 Web dyno 上的启动超时将显示此错误。 根据java-webapp-runner
将 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>
将您的 Procfile 更改为
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
然后尝试重新部署。
查看我在 github 上部署的这个项目,如果它可以帮助您在 Heroku 上获得更多示例项目。
可以分享github上的项目吗?
在根文件夹中创建“ Procfile ”并在其上设置以下代码后,服务器开始工作:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar build/libs/my-nice-app-0.0.1-SNAPSHOT.jar
只要确保:
文档: https : //devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku#prerequisites
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.