2016-11-21 134 views
0

我試圖部署一個簡單的SpringMVC REST API到Heroku - 我有github上的示例代碼。當我部署到Heroku上,應用程序無法正常工作 - 這是我在在Heroku上的日誌文件中看到:在Heroku上的春季啓動 - H10「應用程序崩潰」

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=

我沒有問題,在本地運行的應用程序。

有沒有一個地方,我可以訪問有關Heroku出現問題的更多信息?我正在使用「Github部署」管道部署應用程序。

回答

1

您發佈的日誌被截斷(您可以通過運行heroku logs -n 2000 -a youapp獲取更多日誌)。但是,使用Github上的代碼,我發現了錯誤:

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

因此,有在classpath中的錯誤。我懷疑這不會發生在本地,因爲類路徑順序是非確定性的。

嘗試從您的依賴關係中刪除slf4j-simple-1.7.21。你可以這樣做,通過改變你的swagger-codegen依賴:

<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> 
+0

這完全做到了 - 謝謝,我正在運行。 – jkerak