gpt4 book ai didi

java - docker 容器上的 Eureka : unknown host exception

转载 作者:行者123 更新时间:2023-12-01 10:36:01 26 4
gpt4 key购买 nike

我试图通过 docker 容器上的 spring boot 启动 eureka 服务器并收到以下异常“unknownhostexception”。现在,在 eureka config.properties 文件中,我使用主机名作为 localhost,但异常(exception)情况是它以某种方式使用容器的主机名,而不是使用我在 eureka 属性文件中定义的主机名。此外,即使它使用容器定义的主机名,它也可以在容器上很好地解析到正确的 IP,并且在/etc/hosts 中有条目。

注意:

  1. 仅当我使用 oracle java 7/8 时,此情况才可重现,但在 openjdk 7 上工作正常。任何线索可能是什么问题。
  2. 尝试在 Eureka 属性中使用 127.0.0.1 代替 localhost,但没有成功。

Eureka 配置文件内容:

# Configure this Discovery Server
eureka:
instance:
hostname: localhost
client: # Not a client, don't register with yourself
registerWithEureka: false
fetchRegistry: false

server:
port: 1111 # HTTP (Tomcat) port

异常堆栈跟踪:

2016-01-11 20:04:54 INFO  RegistrationServer:47 - Starting RegistrationServer v0.0.1-SNAPSHOT with PID 1 (/Jars/registration-service-0.0.1-SNAPSHOT.jar started by root in /)
2016-01-11 20:04:54 INFO AnnotationConfigApplicationContext:510 - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@70ab4338: startup date [Mon Jan 11 20:04:54 GMT 2016]; root of context hierarchy
2016-01-11 20:04:55 INFO AutowiredAnnotationBeanPostProcessor:153 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-01-11 20:04:55 INFO Version:27 - HV000001: Hibernate Validator 5.1.3.Final
2016-01-11 20:04:55 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'encrypt.CONFIGURATION_PROPERTIES' of type [class org.springframework.cloud.bootstrap.encrypt.KeyProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:04:55 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'encryptionBootstrapConfiguration' of type [class org.springframework.cloud.bootstrap.encrypt.EncryptionBootstrapConfiguration$$EnhancerBySpringCGLIB$$58540477] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:04:56 INFO RegistrationServer:56 - Started RegistrationServer in 2.695 seconds (JVM running for 7.037)

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
[32m :: Spring Boot :: [39m [2m (v1.2.4.RELEASE)[0;39m

2016-01-11 20:04:57 INFO AnnotationConfigEmbeddedWebApplicationContext:510 - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@70ab4338
2016-01-11 20:05:00 WARN PathMatchingResourcePatternResolver:652 - Skipping [/tmp/spring-boot-libs/06f98804e83cf4a94380b46591b976b1d17c36b8-eureka-client-1.1.147.jar] because it does not denote a directory
2016-01-11 20:05:01 WARN PathMatchingResourcePatternResolver:652 - Skipping [/tmp/spring-boot-libs/b8da6470c5c08e33f9ae3737f338b4b81696fa98-eureka-core-1.1.147.jar] because it does not denote a directory
2016-01-11 20:05:04 INFO DefaultListableBeanFactory:822 - Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2016-01-11 20:05:05 INFO DefaultListableBeanFactory:822 - Overriding bean definition for bean 'infoEndpoint': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration; factoryMethodName=infoEndpoint; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointAutoConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$InfoEndpointRebinderConfiguration; factoryMethodName=infoEndpoint; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/autoconfigure/RefreshAutoConfiguration$InfoEndpointRebinderConfiguration.class]]
2016-01-11 20:05:06 INFO GenericScope:230 - BeanFactory id=0e0ed65b-ca3b-3a06-a0e2-4597f85dabe8
2016-01-11 20:05:06 INFO AutowiredAnnotationBeanPostProcessor:153 - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9787da3e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'transactionAttributeSource' of type [class org.springframework.transaction.annotation.AnnotationTransactionAttributeSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'transactionInterceptor' of type [class org.springframework.transaction.interceptor.TransactionInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.transaction.config.internalTransactionAdvisor' of type [class org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:07 INFO PostProcessorRegistrationDelegate$BeanPostProcessorChecker:309 - Bean 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$ConfigurationPropertiesRebinderConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshAutoConfiguration$ConfigurationPropertiesRebinderConfiguration$$EnhancerBySpringCGLIB$$888ac754] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-01-11 20:05:09 INFO TomcatEmbeddedServletContainer:79 - Tomcat initialized with port(s): 1111 (http)
2016-01-11 20:05:10 INFO StandardService:180 - Starting service Tomcat
2016-01-11 20:05:10 INFO StandardEngine:180 - Starting Servlet Engine: Apache Tomcat/8.0.23
2016-01-11 20:05:11 INFO [/]:180 - Initializing Spring embedded WebApplicationContext
2016-01-11 20:05:11 INFO ContextLoader:268 - Root WebApplicationContext: initialization completed in 14097 ms
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'metricFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'characterEncodingFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'webRequestTraceFilter' to: [/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:299 - Mapping filter: 'servletContainer' to urls: [/eureka/*]
2016-01-11 20:05:17 INFO FilterRegistrationBean:286 - Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-01-11 20:05:17 INFO ServletRegistrationBean:188 - Mapping servlet: 'dispatcherServlet' to [/]
2016-01-11 20:05:17 INFO WebApplicationImpl:785 - Initiating Jersey application, version 'Jersey: 1.13 06/29/2012 05:14 PM'
2016-01-11 20:05:28 ERROR EurekaInstanceConfigBean:122 - Cannot get host info
java.net.UnknownHostException: ef769e37c05f: ef769e37c05f: Name or service not known
at java.net.InetAddress.getLocalHost(InetAddress.java:1475)
at org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.initHostInfo(EurekaInstanceConfigBean.java:118)
at org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean.<init>(EurekaInstanceConfigBean.java:50)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration.eurekaInstanceConfigBean(EurekaClientAutoConfiguration.java:81)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d.CGLIB$eurekaInstanceConfigBean$3(<generated>)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d$$FastClassBySpringCGLIB$$a2b83124.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:309)
at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$$EnhancerBySpringCGLIB$$2debd82d.eurekaInstanceConfigBean(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1119)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1014)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1120)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1044)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
at com.cisco.microservice.registration.RegistrationServer.main(RegistrationServer.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:53)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: ef769e37c05f: Name or service not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:901)
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1295)
at java.net.InetAddress.getLocalHost(InetAddress.java:1471)
... 50 more
2016-01-11 20:05:28 WARN URLConfigurationSource:120 - No URLs will be polled as dynamic configuration sources.
2016-01-11 20:05:28 INFO URLConfigurationSource:121 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-01-11 20:05:28 INFO DynamicPropertyFactory:281 - DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@69f889
2016-01-11 20:05:29 INFO RequestMappingHandlerAdapter:517 - Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@70ab4338
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[//lastn],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.lastn(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.cloud.netflix.eureka.server.EurekaController.status(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.Object>)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2016-01-11 20:05:29 INFO RequestMappingHandlerMapping:217 - Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:29 INFO SimpleUrlHandlerMapping:314 - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/metrics/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/metrics],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/trace],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/health],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/configprops],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/refresh],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/pause],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/autoconfig],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/info],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/mappings],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env/reset],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/restart],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/archaius],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/dump],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env/{name:.*}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/env],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/beans],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-01-11 20:05:32 INFO EndpointHandlerMapping:217 - Mapped "{[/resume],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-01-11 20:05:32 INFO SpringTemplateLoader:61 - SpringTemplateLoader for FreeMarker: using resource loader [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@68eefca4: startup date [Mon Jan 11 20:04:57 GMT 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@70ab4338] and template loader path [classpath:/templates/]
2016-01-11 20:05:32 INFO FreeMarkerConfigurer:127 - ClassTemplateLoader for Spring macros added to FreeMarker configuration
2016-01-11 20:05:33 WARN URLConfigurationSource:120 - No URLs will be polled as dynamic configuration sources.
2016-01-11 20:05:33 INFO URLConfigurationSource:121 - To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:431 - Registering beans for JMX exposure on startup
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'restartEndpoint' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'refreshScope' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:912 - Bean with name 'environmentManager' has been autodetected for JMX exposure
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=68eefca4,type=ConfigurationPropertiesRebinder]
2016-01-11 20:05:33 INFO AnnotationMBeanExporter:674 - Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.bootstrap.config:name=refreshEndpoint,type=RefreshEndpoint]
2016-01-11 20:05:33 INFO EndpointMBeanExporter:431 - Registering beans for JMX exposure on startup
2016-01-11 20:05:33 INFO DefaultLifecycleProcessor:341 - Starting beans in phase 0
2016-01-11 20:05:33 INFO EurekaConfigBasedInstanceInfoProvider:80 - Setting initial instance status as: STARTING
^C^C2016-01-11 20:05:35 INFO AnnotationConfigApplicationContext:862 - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@70ab4338: startup date [Mon Jan 11 20:04:54 GMT 2016]; root of context hierarchy
^C^C

最佳答案

通过在 docker 文件中添加以下解决方案解决了问题:

# Fix DNS resolution issues when nss is not installed
RUN echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf

# Set DNS cache to 10 seconds (Cache is permanent by default). Network hosts are volatile in Docker clusters.
RUN grep '^networkaddress.cache.ttl=' /opt/${JAVA_PACKAGE}/jre/lib/security/java.security || echo 'networkaddress.cache.ttl=10' >> /opt/${JAVA_PACKAGE}/jre/lib/security/java.security

关于java - docker 容器上的 Eureka : unknown host exception,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34730542/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com