简体   繁体   中英

Deploying a Spring boot app to Heroku

I've been recently trying to deploy an app to Heroku, but it has been proven to be a nightmare to do so. I've got a little web app that works just fine when run locally on my computer, but when run on Heroku, it complaints about a number of errors and I dont have an idea why. I've spent good 10 hours trying to figure out whats going on, but I'm no wiser :/

This is the error I'm getting on Heroku:

2015-07-31T12:27:23.402408+00:00 app[web.1]: 2015-07-31 12:27:23.388  INFO 5 --- [           main] net.wazim.chestnut.ChestnutRunner        : Starting ChestnutRunner on 535432cb-b4ba-4353-b753-c90ba501b299 with PID 5 (/app/target/chestnut-jar-with-dependencies.jar started by u55201 in /ap
)
2015-07-31T12:27:23.541824+00:00 app[web.1]: 2015-07-31 12:27:23.541  INFO 5 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6e6c3152: startup date [Fri Jul 31 12:27:23 UTC
015]; root of context hierarchy
2015-07-31T12:27:24.289699+00:00 app[web.1]: 2015-07-31 12:27:24.289 ERROR 5 --- [           main] o.s.boot.SpringApplication               : Application startup failed
2015-07-31T12:27:24.289702+00:00 app[web.1]:
2015-07-31T12:27:24.289704+00:00 app[web.1]: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServl
tContainerFactory bean.
2015-07-31T12:27:24.289705+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
2015-07-31T12:27:24.289707+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
2015-07-31T12:27:24.289708+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
2015-07-31T12:27:24.289711+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
2015-07-31T12:27:24.289714+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
2015-07-31T12:27:24.289713+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
2015-07-31T12:27:24.289710+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
2015-07-31T12:27:24.289719+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
2015-07-31T12:27:24.289716+00:00 app[web.1]:    at net.wazim.chestnut.ChestnutRunner.main(ChestnutRunner.java:20)
2015-07-31T12:27:24.289723+00:00 app[web.1]:    ... 7 common frames omitted
2015-07-31T12:27:24.289718+00:00 app[web.1]: Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
2015-07-31T12:27:24.289720+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
2015-07-31T12:27:24.289725+00:00 app[web.1]:
2015-07-31T12:27:24.289722+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
2015-07-31T12:27:24.292299+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
2015-07-31T12:27:24.291255+00:00 app[web.1]: Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext d
e to missing EmbeddedServletContainerFactory bean.
2015-07-31T12:27:24.293484+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
2015-07-31T12:27:24.292817+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
2015-07-31T12:27:24.293709+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
2015-07-31T12:27:24.293881+00:00 app[web.1]:    at net.wazim.chestnut.ChestnutRunner.main(ChestnutRunner.java:20)
2015-07-31T12:27:24.295144+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
2015-07-31T12:27:24.294360+00:00 app[web.1]: Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
2015-07-31T12:27:24.287624+00:00 app[web.1]: 2015-07-31 12:27:24.286  WARN 5 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt
2015-07-31T12:27:24.287629+00:00 app[web.1]:
2015-07-31T12:27:24.287632+00:00 app[web.1]: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServl
tContainerFactory bean.
2015-07-31T12:27:24.287635+00:00 app[web.1]:    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
2015-07-31T12:27:24.287634+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
2015-07-31T12:27:24.287637+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
2015-07-31T12:27:24.287638+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
2015-07-31T12:27:24.287640+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
2015-07-31T12:27:24.287642+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
2015-07-31T12:27:24.287643+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
2015-07-31T12:27:24.287644+00:00 app[web.1]:    at net.wazim.chestnut.ChestnutRunner.main(ChestnutRunner.java:20)
2015-07-31T12:27:24.287646+00:00 app[web.1]: Caused by: org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.
2015-07-31T12:27:24.287653+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
2015-07-31T12:27:24.287655+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:156)
2015-07-31T12:27:24.287656+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
2015-07-31T12:27:24.287658+00:00 app[web.1]:    ... 7 common frames omitted
2015-07-31T12:27:24.287659+00:00 app[web.1]:
2015-07-31T12:27:24.292573+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
2015-07-31T12:27:24.288925+00:00 app[web.1]: 2015-07-31 12:27:24.288  INFO 5 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed to start with classpath: [file:/app/target/chestnut-jar-with-dependencies.jar]
2015-07-31T12:27:24.293047+00:00 app[web.1]:    at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
2015-07-31T12:27:24.291522+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
2015-07-31T12:27:24.294699+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getEmbeddedServletContainerFactory(EmbeddedWebApplicationContext.java:183)
2015-07-31T12:27:24.295403+00:00 app[web.1]:    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
2015-07-31T12:27:24.295483+00:00 app[web.1]:    ... 7 more
2015-07-31T12:27:25.312750+00:00 heroku[web.1]: State changed from starting to crashed
2015-07-31T12:27:25.296215+00:00 heroku[web.1]: Process exited with status 1
2015-07-31T12:27:30.103618+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=agile-dusk-9746.herokuapp.com request_id=cce27fd9-9bbc-4a9e-9611-b38535dc9ade fwd="82.3.147.97" dyno= connect= service= status=503 bytes=

试试java $JAVA_OPTS -Dserver.port=$PORT -jar ...到Procfile

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