Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

其他组件启动都没有问题,就是client启动报错了 #19

Open
zhouguanglong1 opened this issue Jan 16, 2019 · 11 comments
Open
Assignees
Labels
question Further information is requested

Comments

@zhouguanglong1
Copy link

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CIMClient': Invocation of init method failed; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.17.48.1:11211
at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:137) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:409) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1620) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.10.RELEASE.jar:4.3.10.RELEASE]

@zhouguanglong1
Copy link
Author

大佬,有空帮忙看一下

@crossoverJie crossoverJie self-assigned this Jan 16, 2019
@crossoverJie crossoverJie added the question Further information is requested label Jan 16, 2019
@crossoverJie
Copy link
Owner

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection timed out: no further information: /172.17.48.1:11211

本地的这个服务连不上: 172.17.48.1:11211,是不是没有启动。

@ghost
Copy link

ghost commented Jan 16, 2019

telnet 试一下本地端口是否可以连上

@rainbowyao
Copy link

我也是一样的问题,部署到阿里云的时候 客户端连接超时。

@crossoverJie
Copy link
Owner

我也是一样的问题,部署到阿里云的时候 客户端连接超时。

@rainbowyao 可以看看注册到 ZK 里的服务地址是多少,多网卡加上内网环境可能会出现注册了内网地址的问题。

@immime
Copy link

immime commented Jan 29, 2019

本地环境启动 cim-client 工程报错

环境信息如下:

宿主机
ip:192.168.0.199
运行任务:cim-zk、cim-server、cim-forward-route、cim-client

虚拟机
ip: 10.211.55.5
运行任务:zookeeper

以下是 cim-client 启动错误的堆栈信息

2019-01-29 17:23:52.710  INFO 43403 --- [           main] c.c.cim.client.CIMClientApplication      : Starting CIMClientApplication on Jooohns-MacBook-Pro.local with PID 43403 (/Users/weny/Documents/workspace/web/sample.com/cim/cim-client/target/classes started by weny in /Users/weny/Documents/workspace/web/sample.com/cim)
2019-01-29 17:23:52.713  INFO 43403 --- [           main] c.c.cim.client.CIMClientApplication      : No active profile set, falling back to default profiles: default
2019-01-29 17:23:52.756  INFO 43403 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@8e0379d: startup date [Tue Jan 29 17:23:52 CST 2019]; root of context hierarchy
2019-01-29 17:23:54.223  INFO 43403 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8082 (http)
2019-01-29 17:23:54.231  INFO 43403 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2019-01-29 17:23:54.232  INFO 43403 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.16
2019-01-29 17:23:54.319  INFO 43403 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2019-01-29 17:23:54.319  INFO 43403 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1566 ms
2019-01-29 17:23:54.526  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2019-01-29 17:23:54.530  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2019-01-29 17:23:54.530  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2019-01-29 17:23:54.530  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-01-29 17:23:54.530  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-01-29 17:23:54.530  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2019-01-29 17:23:54.531  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2019-01-29 17:23:54.531  INFO 43403 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2019-01-29 17:23:54.849  INFO 43403 --- [           main] c.c.cim.client.client.CIMClient          : cimServer=[ServerInfo{ip='169.254.136.188', cimServerPort=11211, httpPort=8081}]
2019-01-29 17:24:24.938  WARN 43403 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CIMClient': Invocation of init method failed; nested exception is io.netty.channel.ConnectTimeoutException: connection timed out: /169.254.136.188:11211
2019-01-29 17:24:24.941  INFO 43403 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2019-01-29 17:24:24.956  INFO 43403 --- [           main] utoConfigurationReportLoggingInitializer : 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2019-01-29 17:24:24.966 ERROR 43403 --- [           main] o.s.boot.SpringApplication               : Application startup failed

错误信息推断

cim-client 工程在内网环境获取到的 IP 为169.254.136.188 不正确,cim-client 无法访问

该 IP 获取过程 com.crossoverjie.cim.client.client.CIMClient#start --> com.crossoverjie.cim.client.client.CIMClient#userLogin --> com.crossoverjie.cim.route.controller.RouteController#login 返回的 CIMServerResVO 中的 ip 值

原因可能为: cim-server 和 zookeeper 运行在不同的子网,导致从 cim-forward-route 获取的 IP cim-client 无法访问

PS: 验证作者的提示

可以看看注册到 ZK 里的服务地址是多少,多网卡加上内网环境可能会出现注册了内网地址的问题。

查看zookeeper注册信息

[zk: localhost:2181(CONNECTED) 0] ls /
[route, zookeeper]
[zk: localhost:2181(CONNECTED) 1] ls /route
[ip-169.254.136.188:11211:8081]

结果:注册到 ZK 里的服务地址在运行 cim-client 的网络下无法访问

解决过程

当我将 zookeeper 转移到 cim-zk、cim-server、cim-forward-route、cim-client 所在的子网192.168.0.1 ~ 255 中后,cim-client 启动正常了,希望可以为大家提供一点帮助。

2019-01-29 18:41:42.424  INFO 43777 --- [           main] c.c.cim.client.CIMClientApplication      : 启动 Client 服务成功
:ai
Hello,我是估值两亿的 AI 机器人!
你吃饭了吗?
AI:我吃饭了!
2019-01-29 18:42:07.236  INFO 43777 --- [    scan-thread] c.crossoverjie.cim.client.scanner.Scan   : zhangsan:【你吃饭了吗?】

你吃饭了吗?
2019-01-29 18:42:35.547  WARN 43777 --- [    scan-thread] c.c.cim.client.service.impl.MsgHandler   : 不能发送空消息!
AI:我吃饭了!
2019-01-29 18:42:35.547  INFO 43777 --- [    scan-thread] c.crossoverjie.cim.client.scanner.Scan   : zhangsan:【你吃饭了吗?】

@crossoverJie crossoverJie reopened this Feb 20, 2019
@crossoverJie crossoverJie pinned this issue Feb 20, 2019
@EzioYang12138
Copy link

启动客户端只显示了一行错误就退出了

[2020-03-29 10:03:13] zhangsan$ 登录信息不匹配!

Process finished with exit code 255

image

请问这是怎么回事啊,谢谢大佬解答

@EzioYang12138
Copy link

image

图片传不上来。。。

@crossoverJie
Copy link
Owner

crossoverJie commented Mar 31, 2020

[2020-03-29 10:03:13] zhangsan$ 登录信息不匹配!

@jdkYang 我 demo 里配置的 zhangsan 这个用户得在你自己的服务中注册才行,详情请看这里:
https://github.com/crossoverJie/cim#%E6%B3%A8%E5%86%8C%E8%B4%A6%E5%8F%B7

@CarterPlus
Copy link

我遇到同样的问题,使用java -jar cim-client-1.0.0-SNAPSHOT.jar --server.port=8084 --cim.user.id=1602300121383 --cim.user.userName=libuwei --cim.route.url=http://154.8.222.62:8083/去登录时报错:The User information you have used is incorrect! ,主要是因为redis中没有相关数据,可以先执行作者的curl命令,(curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ "reqNo": "123456789", "timeStamp": 0, "userName": "libuwei"}' 'http://154.8.222.62:8083/registerAccount'),当生成一个用户时再去启动cim-client服务。另外也可以去redis按照:cim-account:1602300121383(这个时userId)添加进去。

@mingtianshi
Copy link

开启了其他的使用

curl -X POST --header ' Content-Type: application/json ' --header ' Accept: application/json ' -d ' { 
  "reqNo": "1234567890", 
  "timeStamp": 0, 
  "userName": "zhangsan" 
} '  ' http://localhost:8083/registerAccount '

也注册不了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

7 participants