Vla*_*ich 5 java spring heroku
我正在尝试将我的应用程序部署到 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
Run Code Online (Sandbox Code Playgroud)
像往常一样,但我这个问题的原因可能有所不同。
这是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";
}
}
Run Code Online (Sandbox Code Playgroud)
过程文件:
web: java -Dserver.port=$PORT -jar target/untitled-1.0-SNAPSHOT.jar
Run Code Online (Sandbox Code Playgroud)
H10 错误意味着:Web dyno 崩溃或 Web dyno 启动超时将出现此错误。根据 java-webapp-runner
将 webapp runner 添加到 pom.xml 中的插件部分
<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>
Run Code Online (Sandbox Code Playgroud)将您的 Procfile 更改为
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
然后尝试重新部署。
查看我部署在 github 上的这个项目是否可以帮助您在 Heroku 上获得更多示例项目。
可以在github上分享一下项目吗?
归档时间: |
|
查看次数: |
7623 次 |
最近记录: |