Не удалось установить TCP-соединение с портом 8080 при переходе в поворотный режим. - PullRequest
0 голосов
/ 22 сентября 2019

Я новичок в литейном производстве.У меня проблема при нажатии приложения Java, я столкнулся с проблемой при проверке работоспособности.

The error was Failed to make TCP connection to port 8080: connection refused

Пожалуйста, помогите мне решить эту проблему

РЕДАКТИРОВАТЬ: я использую сервис Eureka, Zuul и центральный конфиг.когда я запускаю приложение локально, оно работает нормально, но когда я нажимаю на PCF, оно получает следующее сообщение об ошибке:

2019-09-26T17:51:08.273+07:00 [APP/PROC/WEB/0] [OUT] :: Spring Boot :: (v2.1.3.RELEASE)
2019-09-26T17:51:08.423+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:08.418 INFO 18 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : https://fo-config.cfapps.io/globalconfig
2019-09-26T17:51:08.982+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:08.981 INFO 18 --- [ main] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
2019-09-26T17:51:08.984+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:08.984 INFO 18 --- [ main] ContainerTrustManagerFactory$PKIXFactory : Adding TrustManager for /etc/ssl/certs/ca-certificates.crt
2019-09-26T17:51:09.022+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:08.994 INFO 18 --- [tificates.crt-0] org.cloudfoundry.security.FileWatcher : Start watching /etc/ssl/certs/ca-certificates.crt
2019-09-26T17:51:09.409+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.409 INFO 18 --- [ main] c.s.FileWatchingX509ExtendedTrustManager : Initialized TrustManager for /etc/ssl/certs/ca-certificates.crt
2019-09-26T17:51:09.414+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.414 INFO 18 --- [ main] oundryContainerKeyManagerFactory$SunX509 : Adding System Key Manager
2019-09-26T17:51:09.426+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.423 INFO 18 --- [ main] oundryContainerKeyManagerFactory$SunX509 : Adding Key Manager for /etc/cf-instance-credentials/instance.key and /etc/cf-instance-credentials/instance.crt
2019-09-26T17:51:09.453+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.451 INFO 18 --- [-instance.crt-0] org.cloudfoundry.security.FileWatcher : Start watching /etc/cf-instance-credentials/instance.crt
2019-09-26T17:51:09.455+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.455 INFO 18 --- [-instance.key-0] org.cloudfoundry.security.FileWatcher : Start watching /etc/cf-instance-credentials/instance.key
2019-09-26T17:51:09.585+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:09.585 INFO 18 --- [ main] o.c.s.FileWatchingX509ExtendedKeyManager : Initialized KeyManager for /etc/cf-instance-credentials/instance.key and /etc/cf-instance-credentials/instance.crt
2019-09-26T17:51:11.629+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:11.629 INFO 18 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=be-customer-management-development, generic-development, profiles=[cloud,development], label=null, version=1d78f7db2bedb1e0709ad852d76819406bec9fa5, state=null
2019-09-26T17:51:11.630+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:11.630 INFO 18 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}, MapPropertySource {name='http://gitlab.difinite.com/bombardier/config-repository.git/generic-development.properties'}, MapPropertySource {name='http://gitlab.difinite.com/bombardier/config-repository.git/be-customer-management-development.properties'}]}
2019-09-26T17:51:11.712+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:11.711 INFO 18 --- [ main] pertySourceApplicationContextInitializer : 'cloud' property source added
2019-09-26T17:51:11.712+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:11.712 INFO 18 --- [ main] nfigurationApplicationContextInitializer : Reconfiguration enabled
2019-09-26T17:51:11.727+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:11.726 INFO 18 --- [ main] c.l.u.BeCustomerManagementApplication : The following profiles are active: cloud,development
2019-09-26T17:51:16.811+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:16.810 INFO 18 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=a89f4659-c9fe-3ba4-8c12-e063dff6a865
2019-09-26T17:51:17.241+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.241 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$870dc353] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.376+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.375 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$1fbb8b8d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.409+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.408 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.413+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.412 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@24959ca4' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.418+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.417 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$44902e3f] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.429+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.428 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:17.455+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:17.454 INFO 18 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$a327c650] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-09-26T17:51:18.386+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.386 INFO 18 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8202 (http)
2019-09-26T17:51:18.642+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.642 INFO 18 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-09-26T17:51:18.642+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.642 INFO 18 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-09-26T17:51:18.680+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.679 INFO 18 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib]
2019-09-26T17:51:18.981+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.981 INFO 18 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-09-26T17:51:18.982+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.982 INFO 18 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 7170 ms
2019-09-26T17:51:20.495+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.494 INFO 18 --- [ main] ContainerTrustManagerFactory$PKIXFactory : Adding System Trust Manager
2019-09-26T17:51:20.686+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.685 INFO 18 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService
2019-09-26T17:51:20.689+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.688 INFO 18 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'asyncExecutor'
2019-09-26T17:51:20.803+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.745 WARN 18 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-09-26T17:51:20.808+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.807 INFO 18 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-09-26T17:51:20.833+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.833 WARN 18 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2019-09-26T17:51:20.834+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:20.833 INFO 18 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2019-09-26T17:51:22.127+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:22.127 INFO 18 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
2019-09-26T17:51:22.127+07:00 [APP/PROC/WEB/0] [OUT] Using generated security password: 00b3eb29-dd56-4666-8d15-f2bfbdfc0c5e
2019-09-26T17:51:22.636+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:22.636 INFO 18 --- [ main] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3c9c0d96, org.springframework.security.web.context.SecurityContextPersistenceFilter@5812f68b, org.springframework.security.web.header.HeaderWriterFilter@1608bcbd, org.springframework.security.web.authentication.logout.LogoutFilter@2f16c6b3, org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter@2766ca9d, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3c7c886c, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6b88ca8c, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3a4621bd, org.springframework.security.web.session.SessionManagementFilter@29ca3d04, org.springframework.security.web.access.ExceptionTranslationFilter@6f63b475, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@73194df]
2019-09-26T17:51:23.594+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.594 INFO 18 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2019-09-26T17:51:23.715+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.712 INFO 18 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1
2019-09-26T17:51:23.715+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.715 INFO 18 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data.
2019-09-26T17:51:23.752+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.752 INFO 18 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1569495083746 with initial instances count: 0
2019-09-26T17:51:23.772+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.772 INFO 18 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application BE-CUSTOMER-MANAGEMENT-TESTING with eureka with status UP
2019-09-26T17:51:23.981+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.981 INFO 18 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8202 (http) with context path ''
2019-09-26T17:51:23.982+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.982 INFO 18 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8202
2019-09-26T17:51:23.986+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:23.985 INFO 18 --- [ main] c.l.u.BeCustomerManagementApplication : Started BeCustomerManagementApplication in 19.976 seconds (JVM running for 21.949)
2019-09-26T17:52:02.056+07:00 [HEALTH/0] [ERR] Failed to make TCP connection to port 8080: connection refused
2019-09-26T17:52:02.056+07:00 [CELL/0] [ERR] Timed out after 1m0s: health check never passed.
2019-09-26T17:52:02.060+07:00 [CELL/SSHD/0] [OUT] Exit status 0
2019-09-26T17:52:02.066+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:52:02.066 INFO 18 --- [ Thread-12] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application BE-CUSTOMER-MANAGEMENT-TESTING with eureka with status DOWN
2019-09-26T17:52:02.087+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:52:02.087 INFO 18 --- [ Thread-12] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'asyncExecutor'
2019-09-26T17:52:02.092+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:52:02.092 INFO 18 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2019-09-26T17:52:02.092+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:52:02.092 INFO 18 --- [ Thread-12] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2019-09-26T17:52:02.516+07:00 [APP/PROC/WEB/0] [OUT] Exit status 143
2019-09-26T17:52:08.348+07:00 [CELL/0] [OUT] Cell e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6 stopping instance 1f1190f4-7f86-40c3-7e68-00b0
2019-09-26T17:52:08.348+07:00 [CELL/0] [OUT] Cell e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6 destroying container for instance 1f1190f4-7f86-40c3-7e68-00b0
2019-09-26T17:52:08.381+07:00 [API/19] [OUT] Process has crashed with type: "web"
2019-09-26T17:52:08.400+07:00 [API/19] [OUT] App instance exited with guid 80895621-4fa9-4603-bbf2-002d283e226f payload: {"instance"=>"1f1190f4-7f86-40c3-7e68-00b0", "index"=>0, "cell_id"=>"e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6", "reason"=>"CRASHED", "exit_description"=>"Instance never healthy after 1m0s: Failed to make TCP connection to port 8080: connection refused", "crash_count"=>3, "crash_timestamp"=>1569495128338465796, "version"=>"6e71e5bc-4ee7-428d-98ac-ec7066b22a9f"}
2019-09-26T17:52:08.540+07:00 [PROXY/0] [OUT] Exit status 137
2019-09-26T17:52:08.932+07:00 [CELL/0] [OUT] Cell e9fa9dcc-6c6e-4cd4-97cd-5781aa4c64e6 successfully destroyed container for instance 1f1190f4-7f86-40c3-7e68-00b0
2019-09-26T17:52:44.720+07:00 [API/5] [OUT] Updating process: "web"
2019-09-26T17:52:51.531+07:00 [CELL/0] [OUT] Cell ccbb6c0b-fe8a-4497-bbda-4c5b42a369bf creating container for instance 06570bc1-ee86-4397-6ff2-ed2c

bootstrap.properties

spring.application.name=be-customer-management-testing
spring.profiles.active=development
spring.cloud.config.uri=https://myUrlGlobalCOnfigInPivotal
spring.cloud.config.name=name1, name2
spring.cloud.config.fail-fast=true
management.endpoints.web.exposure.include=*

application.yml

eureka:
  client:
    serviceUrl:
      defaultZone: ${vcap.services.eureka-service.credentials.uri:http://localhost:8761}/eureka/
    registerWithEureka: false
    fetchRegistry: false

application-cloud.properties

eureka.instance.hostname=${vcap.application.uris[0]}
eureka.instance.non-secure-port=80
eureka.instance.metadata-map.instanceId=${vcap.application.instance_id}

Извините за поздний ответ и обновление

Ответы [ 2 ]

0 голосов
/ 27 сентября 2019

Ваша проблема в том, что Tomcat загружается не с того порта.Из ваших журналов ...

2019-09-26T17:51:18.386+07:00 [APP/PROC/WEB/0] [OUT] 2019-09-26 10:51:18.386 INFO 18 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8202 (http)

Это очень ясно, начиная с порта 8202. Это нарушает проверку работоспособности платформы, потому что платформа просит вас запустить приложение на порту 8080. Поскольку приложение не прослушиваетна запрошенном порту проверка работоспособности не может быть успешно завершена, и Cloud Foundry должен предположить, что ваше приложение никогда не запускалось, поэтому он пытается перезапустить приложение, надеясь, что оно будет работать в следующий раз.К сожалению, это ошибка конфигурации, поэтому она никогда не будет исправлена ​​простым перезапуском, так что цикл будет длиться вечно.

Относительно того, почему ваше приложение запускается через порт 8202, неясно.Я не вижу, чтобы он был установлен в application.yml, который вы указали, но возможно, что он установлен в другом месте.

Для Spring Boot вам нужно установить server.port. Его можно установить в нескольких местах, включая application.properties, application.yml, в качестве переменной env или системного свойства .Это должно быть установлено равным 8080, или, что еще лучше, переменной среды $PORT, которая устанавливается Cloud Foundry и содержит ожидаемый порт, который должно прослушивать ваше приложение.(Примечание: сборка Java должна настраивать это для вас, если вы не перезаписываете команду запуска или делаете что-то, чтобы изменить ее поведение по умолчанию).

Вы поймете, что это правильно, когда Tomcat сообщит, что он запущен на порту8080 и проверка здоровья проходит.

Надеюсь, это поможет!

0 голосов
/ 24 сентября 2019

может быть, ваше приложение на платформе в используемом контейнере создано, но ошибка запуска tomcat приложения

1) Успешная сборка Java-приложения mvn / gradle?

2) в журнале приложений Java, проверка исключений,$ cf logs {your-app} --recent

3) декларация свойств добавления и проверка cf logs

приложений: - имя: {app-name} ...... health-тип проверки: нет <<<< </p>

ваш статус cf push успешен, но в журнал исключений tomcat для java-приложения включено

Надеюсь, это поможет!

...