我正在尝试将一个小型SpringBoot应用程序部署到EBS。我认为我已正确完成了所有事情,包括设置RDS数据库,但部署失败,并且由于运行状况恶化,我收到一个错误消息:下列服务未运行:application-web-1。
我的变量设置如下
GRADLE_HOME
/usr/local/gradle
JAVA_HOME
/usr/lib/jvm/java
M2
/usr/local/apache-maven/bin
M2_HOME
/usr/local/apache-maven
SERVER_PORT
5000
SPRING_DATASOURCE_PASSWORD
***
SPRING_DATASOURCE_URL
jdbc:mysql://***.us-east-2.rds.amazonaws.com/ebdb
SPRING_DATASOURCE_USERNAME
***
SPRING_JPA_DATABASE_PLATFORM
org.hibernate.dialect.MySQL5Dialect
SPRING_JPA_HIBERNATE_DDL_AUTO
***
SPRING_PROFILES_ACTIVE
prod
关于如何调试的任何建议吗?
我的日志如下:
-------------------------------------
/var/log/nginx/error.log
-------------------------------------
2019/03/17 19:02:16 [error] 4817#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 82.29.139.73, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 19:02:17 [error] 4817#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 82.29.139.73, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 19:02:25 [error] 4817#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 82.29.139.73, server: , request: "GET /links/ HTTP/1.1", upstream: "http://127.0.0.1:5000/links/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 19:02:26 [error] 4817#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 82.29.139.73, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/links/"
2019/03/17 19:57:28 [error] 4817#0: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 178.73.215.171, server: , request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:5000/"
2019/03/17 20:53:11 [error] 4817#0: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 104.152.52.21, server: , request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:5000/"
2019/03/17 20:57:57 [error] 4817#0: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 20:57:58 [error] 4817#0: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:06:08 [error] 29457#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:06:08 [error] 29457#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:15:47 [error] 30143#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:15:48 [error] 30143#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:15:54 [error] 30143#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:15:54 [error] 30143#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:25:28 [error] 30981#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:25:28 [error] 30981#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:29:36 [error] 31520#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:29:36 [error] 31520#0: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
2019/03/17 21:34:37 [error] 31520#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com"
2019/03/17 21:34:37 [error] 31520#0: *5 connect() failed (111: Connection refused) while connecting to upstream, client: 151.229.68.196, server: , request: "GET /favicon.ico HTTP/1.1", upstream: "http://127.0.0.1:5000/favicon.ico", host: "ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com", referrer: "http://ddemo-env.ipmbyempmi.us-east-2.elasticbeanstalk.com/"
答案 0 :(得分:0)
嘿,我不确定这是否对您有用,但这就是我解决
的方法以下服务未运行:application-web-1。
问题。我将其剪切到我的弹性beantalk实例上,并将其CD到/ var / log目录中。我注意到有一个
web-1.error.log
日志显示。我查看了该日志文件,但有一个例外导致部署失败。嵌套在我的资源文件夹中的文件夹内的txt文件不可见,并且引发了以下异常。
原因:java.io.FileNotFoundException:URL [jar:file:/var/app/current/application.jar!/ BOOT-INF / classes!/vegetables/vegetables.txt]无法解析为绝对文件路径因为它不驻留在文件系统中:jar:file:/var/app/current/application.jar!/ BOOT-INF / classes!/vegetables/vegetables.txt
发生这种情况是因为我使用PathMatchingResourcePatternResolver来获取资源,然后按文件名遍历资源,然后直接尝试使用resource.getFile()访问文件。而不是通过文件获取数据。我用
byte [] dataArr = FileCopyUtils.copyToByteArray(resource.getInputStream());
,这使我可以像直接访问文件一样使用字节数组中的数据。我希望这会有所帮助。