dubbo 获取不到本地地址,返回 127.0.0.1

 

 

 

2019-08-14 12:29:09.609  WARN 1079 --- [           main] org.apache.dubbo.config.AbstractConfig   :  [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: 2.7.1, current host: 127.0.0.1

 

2019-08-14 12:29:09.968  INFO 1079 --- [           main] o.a.dubbo.registry.nacos.NacosRegistry   :  [DUBBO] Register: consumer://127.0.0.1/com.lkk.platform.system.domain.service.ELPeopleService?application=erdp-discuss-app&category=consumers&check=false&default.check=false&default.cluster=failfast&default.generic=false&default.lazy=false&default.loadbalance=leastactive&default.sticky=false&default.version=1.0.0&dubbo=2.0.2&generic=false&interface=com.lkk.platform.system.domain.service.ELPeopleService&lazy=false&logger=slf4j&methods=batchAddOrUpdate,selectFieldListByActive,checkUserAccount,insertOrUpdate,deleteByMap,queryDimissionPage,getPeopleByOrgIds,updateBatchById,resetButton,insertAllColumn,findUser,expirationReminder,InInsert,getTableName,selectById,getResetPwdByCode,deleteById,insertBatch,selectCount,updateAllColumnById,queryPage,getCodeById,getUser,save,updateAllColumnBatchById,update,insert,delete,selectAvlbFieldList,deleteBatchIds,getUserByCode,fuzzyFindUser,fuzzyQueryPage,getUserByNameOrEmail,get,getIdByCode,updateUserPinyin,batchList,selectPage,updatePwd,getLeaderIdByOrgIds,updateById,selectBatchIds,selectList,selectOne,insertOne,getUserByName,getPeople,getUserView,queryById&pid=1079&release=2.7.1&revision=2.0.2-SNAPSHOT&side=consumer&sticky=false&timestamp=1565756949610, dubbo version: 2.7.1, current host: 127.0.0.1

 

或者

2019-08-14 12:29:10.109  INFO 1079 --- [           main] o.a.dubbo.registry.nacos.NacosRegistry   :  [DUBBO] Subscribe: consumer://127.0.0.1/com.lkk.platform.system.domain.service.ELPeopleService?application=erdp-discuss-app&category=providers,configurators,routers&default.check=false&default.cluster=failfast&default.generic=false&default.lazy=false&default.loadbalance=leastactive&default.sticky=false&default.version=1.0.0&dubbo=2.0.2&generic=false&interface=com.lkk.platform.system.domain.service.ELPeopleService&lazy=false&logger=slf4j&methods=batchAddOrUpdate,selectFieldListByActive,checkUserAccount,insertOrUpdate,deleteByMap,queryDimissionPage,getPeopleByOrgIds,updateBatchById,resetButton,insertAllColumn,findUser,expirationReminder,InInsert,getTableName,selectById,getResetPwdByCode,deleteById,insertBatch,selectCount,updateAllColumnById,queryPage,getCodeById,getUser,save,updateAllColumnBatchById,update,insert,delete,selectAvlbFieldList,deleteBatchIds,getUserByCode,fuzzyFindUser,fuzzyQueryPage,getUserByNameOrEmail,get,getIdByCode,updateUserPinyin,batchList,selectPage,updatePwd,getLeaderIdByOrgIds,updateById,selectBatchIds,selectList,selectOne,insertOne,getUserByName,getPeople,getUserView,queryById&pid=1079&release=2.7.1&revision=2.0.2-SNAPSHOT&side=consumer&sticky=false&timestamp=1565756949610, dubbo version: 2.7.1, current host: 127.0.0.1

 

Register 的地址是  dubbo://127.0.0.1:20880, 这明显不对

 

注意其后面出现:

java.net.UnknownHostException: erdp200: erdp200: 未知的名称或服务

 

erdp200 是我的主机名, 奇怪的事, 竟然识别不了 erdp200?

 

java.net.UnknownHostException: erdp200: erdp200: 未知的名称或服务
    at java.net.InetAddress.getLocalHost(InetAddress.java:1506) ~[na:1.8.0_201]
    at org.apache.dubbo.common.utils.NetUtils.getLocalAddress0(NetUtils.java:245) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.common.utils.NetUtils.getLocalAddress(NetUtils.java:222) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.common.utils.NetUtils.getLocalHost(NetUtils.java:187) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.filter.ConsumerContextFilter.invoke(ConsumerContextFilter.java:45) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:73) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.protocol.InvokerWrapper.invoke(InvokerWrapper.java:56) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.cluster.support.FailfastClusterInvoker.doInvoke(FailfastClusterInvoker.java:48) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker.invoke(AbstractClusterInvoker.java:242) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.cluster.support.wrapper.MockClusterInvoker.invoke(MockClusterInvoker.java:76) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.rpc.proxy.InvokerInvocationHandler.invoke(InvokerInvocationHandler.java:57) [dubbo-2.7.1.jar!/:2.7.1]
    at org.apache.dubbo.common.bytecode.proxy0.selectBatchIds(proxy0.java) [dubbo-2.7.1.jar!/:2.7.1]
    at com.lkk.ppm.discuss.controller.controller.DiscussController.fetchUsers(DiscussController.java:263) [erdp_discuss_controller-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at com.lkk.ppm.discuss.controller.controller.DiscussController.listTopicDiscuss(DiscussController.java:233) [erdp_discuss_controller-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at com.lkk.ppm.discuss.controller.controller.DiscussController$$FastClassBySpringCGLIB$$32bbd2d3.invoke(<generated>) [erdp_discuss_controller-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) [spring-core-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:749) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at com.lkk.platform.common.web.aop.CommonLogAspectHandler.around(CommonLogAspectHandler.java:57) [platform_common_web-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at com.lkk.platform.common.web.aop.ValidateAspectHandel.validateAround(ValidateAspectHandel.java:111) [platform_common_web-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:688) [spring-aop-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at com.lkk.ppm.discuss.controller.controller.DiscussController$$EnhancerBySpringCGLIB$$5b78365a.listTopicDiscuss(<generated>) [erdp_discuss_controller-2.0.2-SNAPSHOT.jar!/:2.0.2-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) [spring-webmvc-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) [tomcat-embed-websocket-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:845) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.filters.RemoteIpFilter.doFilter(RemoteIpFilter.java:902) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.5.jar!/:1.1.5]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) [spring-security-oauth2-2.3.5.RELEASE.jar!/:na]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) [spring-security-web-5.1.4.RELEASE.jar!/:5.1.4.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.1.5.RELEASE.jar!/:5.1.5.RELEASE]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:679) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_201]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_201]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar!/:9.0.16]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_201]
Caused by: java.net.UnknownHostException: erdp200: 未知的名称或服务
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[na:1.8.0_201]
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) ~[na:1.8.0_201]
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) ~[na:1.8.0_201]
    at java.net.InetAddress.getLocalHost(InetAddress.java:1501) ~[na:1.8.0_201]
    ... 127 common frames omitted
View Code

 

 

后面发现 , 需要修改 /etc/hosts , 增加对应的 ip hostname  这样的一行就好了!

 

为什么读取的不是lan 的ip,

而是虚拟网卡的ip:

addressOp = /172.18.0.1
localAddress0 = /172.18.0.1

 

因为我安装了 docker,k8s的原因吗?

# ifconfig
br-ef2850b464e5: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.18.0.1  netmask 255.255.0.0  broadcast 172.18.255.255
        ether 02:42:40:a7:10:04  txqueuelen 0  (Ethernet)
        RX packets 2643595  bytes 4115706912 (3.8 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2643595  bytes 4115706912 (3.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:dff:fe70:3389  prefixlen 64  scopeid 0x20<link>
        ether 02:42:0d:70:33:89  txqueuelen 0  (Ethernet)
        RX packets 4759568754  bytes 371508394572 (345.9 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4774072779  bytes 761901712932 (709.5 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens192: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.11.200  netmask 255.255.255.0  broadcast 192.168.11.255
        inet6 fe80::846:50d2:ba3a:1f28  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:20:55:ed  txqueuelen 1000  (Ethernet)
        RX packets 5201526620  bytes 914341297984 (851.5 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 5135122785  bytes 625366352018 (582.4 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2643595  bytes 4115706912 (3.8 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2643595  bytes 4115706912 (3.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth070da3e: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::828:e0ff:fe7d:8208  prefixlen 64  scopeid 0x20<link>
        ether 0a:28:e0:7d:82:08  txqueuelen 0  (Ethernet)
        RX packets 1291637  bytes 240497841 (229.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1407428  bytes 155779146 (148.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0a306d8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::2032:f0ff:fe4c:c6b5  prefixlen 64  scopeid 0x20<link>
        ether 22:32:f0:4c:c6:b5  txqueuelen 0  (Ethernet)
        RX packets 1501576  bytes 314407273 (299.8 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1967105  bytes 214900891 (204.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth0cd5e30: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::ac0d:90ff:fef3:63a4  prefixlen 64  scopeid 0x20<link>
        ether ae:0d:90:f3:63:a4  txqueuelen 0  (Ethernet)
        RX packets 10298334  bytes 1984915816 (1.8 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11261264  bytes 1707200507 (1.5 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

veth1046ba1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::94af:6aff:fe4c:ef55  prefixlen 64  scopeid 0x20<link>
        ether 96:af:6a:4c:ef:55  txqueuelen 0  (Ethernet)
        RX packets 542741  bytes 35003885 (33.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 544217  bytes 559096100 (533.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

 

 

但是, 同事那边也有这个问题啊, 他都已经加的了, 为什么还这样? 哦, 原来他的hostname 是 localhost.localdomain

 

 

 

我也是醉了, 原来他的hostname没有改, 这样的话,下面的配置的 最后一行是没有用的

 

 /etc/hosts 中手动添加的 ip hostname  从而没有用,因为这里的hostname 并不是其实际的 hostname 。。 难怪呢 难怪他启动dubbo 的时候也没有报 UnknownHostException 的错误,

2019-08-14 15:02:12.784  INFO 16140 --- [           main] o.a.dubbo.registry.nacos.NacosRegistry   :  [DUBBO] Load registry cache file /root/.dubbo/dubbo-registry-erdp-discuss-app-192.168.0.143:8848.cache, data: {com.lkk.platform.system.domain.service.ELPeopleService:1.0.0=dubbo://127.0.0.1:20880/com.lkk.platform.system.domain.service.ELPeopleService?anyhost=true&application=erdp-system-app&bean.name=com.lkk.platform.system.domain.service.ELPeopleService&category=providers&default.cluster=failfast&default.connections=5&default.deprecated=false&default.dynamic=false&default.loadbalance=leastactive&default.register=true&default.retries=0&default.timeout=10000&default.version=1.0.0&deprecated=false&dubbo=2.0.2&dynamic=false&generic=false&interface=com.lkk.platform.system.domain.service.ELPeopleService&logger=slf4j&methods=batchAddOrUpdate,selectFieldListByActive,checkUserAccount,insertOrUpdate,deleteByMap,queryDimissionPage,getPeopleByOrgIds,updateBatchById,resetButton,insertAllColumn,findUser,expirationReminder,InInsert,getTableName,selectById,getResetPwdByCode,deleteById,insertBatch,selectCount,updateAllColumnById,queryPage,getCodeById,getUser,save,updateAllColumnBatchById,update,insert,delete,selectAvlbFieldList,deleteBatchIds,getUserByCode,fuzzyQueryPage,getUserByNameOrEmail,fuzzyFindUser,get,getIdByCode,updateUserPinyin,batchList,selectPage,updatePwd,getLeaderIdByOrgIds,updateById,selectBatchIds,selectList,selectOne,insertOne,getUserByName,getPeople,getUserView,queryById&path=com.lkk.platform.system.domain.service.ELPeopleService&pid=5646&protocol=dubbo&register=true&release=2.7.1&revision=2.0.2-SNAPSHOT&side=provider&threadpool=fixed&threads=50&timeout=1200000&timestamp=1565753463091}, dubbo version: 2.7.1, current host: 127.0.0.1

 

因为 localhost.localdomain 并不是 unknown, 只是解析到最后 org.apache.dubbo.common.utils.NetUtils 只能返回  127.0.0.1。

 

看过 org.apache.dubbo.common.utils.NetUtils 源码,其实他的获取ip 的逻辑还是比较复杂的。 首先是通过hostname 去获取,获取不到才是通过 遍历 网卡的方式,获取到第一个有效的 网卡ip 就返回。 我开始还以为是 linux 机器网卡、虚拟网卡太多了(安装了 docker、k8s)的原因呢!

 

但是 后面 怎么又变成了 127.0.0.1 呢? 。。。 未完待续

 

 

 

 

 

 

 参考

http://www.zuidaima00.com/blog/3658395741932544.htm

http://dubbo.apache.org/zh-cn/blog/dubbo-network-interfaces.html

 

posted on 2019-08-15 09:20  CanntBelieve 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/FlyAway2013/p/11354725.html

  • 0
    点赞
  • 0
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
©️2021 CSDN 皮肤主题: 编程工作室 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值