繁体   English   中英

将Spring Boot应用程序部署到Heroku

[英]Deploying a Spring boot app to Heroku

我最近一直在尝试将应用程序部署到Heroku,但事实证明,这样做是一场噩梦。 我有一个小的网络应用程序,可以在我的计算机上本地运行时正常工作,但是在Heroku上运行时,它抱怨许多错误,我不知道为什么。 我花了10个小时来弄清楚发生了什么事,但是我不明智:/

这是我在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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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