简体   繁体   中英

Spring Boot on Heroku - H10 “app crash”

I am attempting to deploy a simple SpringMVC REST API to Heroku - I have the example code on github . When I deploy to Heroku, the app doesn't work - this is what I see in the log file on Heroku:

2016-11-21T00:28:28.965526+00:00 app[web.1]: at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138) 2016-11-21T00:28:28.965587+00:00 app[web.1]: at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121) 2016-11-21T00:28:28.965642+00:00 app[web.1]: at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:63) 2016-11-21T00:28:28.965701+00:00 app[web.1]: at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48) 2016-11-21T00:28:28.965762+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:304) 2016-11-21T00:28:28.965804+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) 2016-11-21T00:28:28.965865+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) 2016-11-21T00:28:28.965926+00:00 app[web.1]: at com.jkerak.TodoApiApplication.main(TodoApiApplication.java:9) 2016-11-21T00:28:28.965989+00:00 app[web.1]: ... 8 more 2016-11-21T00:28:29.096742+00:00 heroku[web.1]: State changed from starting to crashed 2016-11-21T00:28:29.081552+00:00 heroku[web.1]: Process exited with status 1 2016-11-21T00:51:54.625237+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=jkerak-todoapi.herokuapp.com request_id=73c76e69-2084-436f-b829-dd533562d13a fwd="73.30.84.74" dyno= connect= service= status=503 bytes=

I have no problem running the app locally.

Is there a place I can access more information about what is going wrong on Heroku? I am deploying the app using the "Github deployment" pipeline.

The logs you posted are truncated (you can get more logs by running heroku logs -n 2000 -a youapp ). But using the code on Github, I found the error:

Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.SimpleLoggerFactory loaded from jar:file:/app/target/todoApi-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/slf4j-simple-1.7.21.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.SimpleLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext

So there is an error on your classpath. I suspect this does not happen locally because the classpath order is non-deterministic.

Try removing slf4j-simple-1.7.21 from your dependencies. You can do this by changing your swagger-codegen dependency thusly:

<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen</artifactId>
    <version>2.2.1</version>
    <exclusions>
    <exclusion>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-simple</artifactId>
    </exclusion>
  </exclusions>
</dependency>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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