应用程序是健康的,直到application.properties与app捆绑在一起。
下一步,使用以下语句移动属性以配置repo并在云代工厂中创建config-service。
cf create-service -c '{ "git": { "uri": "https://bitbucket.company.com/scm/abcdefg/app-configs", "label": "master", "searchPaths": "TOPFOLDER/app-folder", "username": "abcdef", "password": "123456" } }' p-config-server standard company-appname-config-server
然后将依赖项添加到我的java应用程序(build.gradle)
compile("io.pivotal.spring.cloud:spring-cloud-services-starter-config-client:${pivotalSpringCloud}")
compile("org.springframework.cloud:spring-cloud-dependencies:Camden.SR4")
重新部署并且应用程序在正确的属性下变得健康。 在日志中我看到了
2017-04-24T08:10:48.16-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:48.162 INFO 19 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: https://config-d45c8d75-67f0-4031-804a-3a23cb139b4a.company.com
应用程序不到20秒。以下是日志(将healthchecktimeout从默认值增加到180)。
2017-04-24T08:07:56.67-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.670 INFO 14 --- [ main] o.s.i.a.i.AmqpInboundChannelAdapter : started inbound
2017-04-24T08:07:56.67-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.670 INFO 14 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2017-04-24T08:07:56.74-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.742 INFO 14 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8008 (http)
2017-04-24T08:07:56.74-0500 [APP/PROC/WEB/0]OUT Running as daemon
2017-04-24T08:07:56.75-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:07:56.752 INFO 14 --- [ main] c.company.app.MainApplication : Started CoordinatorBotApplication in 16.636 seconds (JVM running for 17.211)
2017-04-24T08:08:06.91-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:08:06.915 DEBUG 14 --- [ask-scheduler-1] heduler$$EnhancerBySpringCGLIB$$cbc32e8f : []
2017-04-24T08:09:37.08-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:09:37.086 DEBUG 14 --- [ask-scheduler-1] heduler$$EnhancerBySpringCGLIB$$cbc32e8f : []
2017-04-24T08:10:40.65-0500 [CELL/0] ERR Timed out after 3m0s: health check never passed.
2017-04-24T08:10:40.65-0500 [CELL/0] OUT Exit status 0
2017-04-24T08:10:40.66-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:40.660 INFO 14 --- [ Thread-4] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@5ae9a829: startup date [Mon Apr 24 08:07:44 CDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@15327b79 }
在关机日志之后,我会看到此错误,然后再次创建一个容器。
2017-04-24T08:10:40.76-0500 [APP/PROC/WEB/0]OUT 2017-04-24 13:10:40.762 INFO 14 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2017-04-24T08:10:41.17-0500 [APP/PROC/WEB/0]OUT Exit status 143
2017-04-24T08:10:41.18-0500 [CELL/0] OUT Destroying container
2017-04-24T08:10:41.20-0500 [API/1] OUT Process has crashed with type: "web"
2017-04-24T08:10:41.21-0500 [API/1] OUT App instance exited with guid dc395017-3770-4617-a439-2a0fd5fb6dda payload: {"instance"=>"", "index"=>0, "reason"=>"CRASHED", "exit_description"=>"2 error(s) occurred:\n\n* 1 error(s) occurred:\n\n* Exited with status 4\n* 2 error(s) occurred:\n\n* cancelled\n* cancelled", "crash_count"=>1, "crash_timestamp"=>1493039441179549849, "version"=>"246e48d2-45fe-47ed-a1ee-d4b05bd6599e"}
2017-04-24T08:10:41.22-0500 [CELL/0] OUT Creating container
有什么建议吗? 做错了吗? 有什么方法可以获得进一步的调试细节吗
答案 0 :(得分:1)
解决。
该问题与我尝试使用启动属性使用的特定端口号有关。
最初我独立运行此应用程序(因为我有多个启动应用程序,我计划在特定端口上运行每个应用程序。)
但是在PCF中,我们不需要特定的端口,因为每个应用程序都在其容器上运行,具有不同的唯一路径(组件+域)。
删除特定端口 - 解决了我的问题