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

Dubbo Telnet Unsupported command: ls #5690

Closed
2 tasks done
sunlongv587 opened this issue Jan 21, 2020 · 4 comments · Fixed by #5815
Closed
2 tasks done

Dubbo Telnet Unsupported command: ls #5690

sunlongv587 opened this issue Jan 21, 2020 · 4 comments · Fixed by #5815
Labels
type/bug Bugs to being fixed

Comments

@sunlongv587
Copy link

sunlongv587 commented Jan 21, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.5
  • Operating System version: macOs Mojave 10.14.6
  • Java version: 1.8

Steps to reproduce this issue

  1. 正常启动项目后无法使用telnet的ls,cd,invoke等命令;
  2. 自己通过debug发现,在读取/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler这个配置文件的时候,在解析第6到14这几行的时候,出现了类加载失败的情况。
  3. 于是我便去源码中找了这几个类,发现它们的包结构和之前的版本2.7.4.1有所不同。
  4. 这几个类由org.apache.dubbo.rpc.protocol.dubbo.telnet包移动到了org.apache.dubbo.qos.legacy这个包下面。
  5. 我不知道我有没有找到根本原因,但这一定是其中之一,目前也有一个解决办法,并且我已经使用这个方法解决了这个问题。我把这些加载失败的Telnet类,放到了Telnet扩展中。

解决方案

把临时解决方案贴上来,希望能帮助遇到同样问题的小伙伴。
在项目resources目录中添加META-INF/dubbo/org.apache.dubbo.remoting.telnet.TelnetHandler文本文件,然后将加载失败的类包名修改后,配置到文件中。

文件内容如下:

ls=org.apache.dubbo.qos.legacy.ListTelnetHandler
ps=org.apache.dubbo.qos.legacy.PortTelnetHandler
cd=org.apache.dubbo.qos.legacy.ChangeTelnetHandler
pwd=org.apache.dubbo.qos.legacy.CurrentTelnetHandler
invoke=org.apache.dubbo.qos.legacy.InvokeTelnetHandler
trace=org.apache.dubbo.qos.legacy.TraceTelnetHandler
count=org.apache.dubbo.qos.legacy.CountTelnetHandler
select=org.apache.dubbo.qos.legacy.SelectTelnetHandler
shutdown=org.apache.dubbo.qos.legacy.ShutdownTelnetHandler
clear=org.apache.dubbo.remoting.telnet.support.command.ClearTelnetHandler
exit=org.apache.dubbo.remoting.telnet.support.command.ExitTelnetHandler
help=org.apache.dubbo.remoting.telnet.support.command.HelpTelnetHandler
status=org.apache.dubbo.remoting.telnet.support.command.StatusTelnetHandler
log=org.apache.dubbo.remoting.telnet.support.command.LogTelnetHandler

在项目中添加配置项:

dubbo.protocol.telnet=clear,exit,help,status,log,ls,ps,cd,pwd,invoke,trace,count,select,shutdown

使用方法在官方文档中有说明:扩展telnet
这个问题修改/META-INF/dubbo/internal/org.apache.dubbo.remoting.telnet.TelnetHandler的文件内容后就会解决,如有使用不当之处,还望开发者回复。

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

Unsupported command: ls
@softicer
Copy link

果然可以,感谢。

@LiosWong
Copy link
Contributor

LiosWong commented Feb 6, 2020

在dubbo-demo中运行provider后,使用telnet也会出现同样的问题

@hesherya
Copy link

我去,原来是个坑。

@chenshun00
Copy link

➜  ~ telnet 127.0.0.1 20880
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
ls
Unsupported command: ls
dubbo>ls
Unsupported command: ls
dubbo>status -l
+------------+--------+--------------------------------------------------------+
| resource   | status | message                                                |
+------------+--------+--------------------------------------------------------+
| datasource | OK     | dataSourcejdbc:mysql://127.0.0.1:3306/cmdb?useUnicode=true&characterEncoding=utf-8&autoReconnect=true(MySQL-5.7.27) |
| load       | OK     | load:3.7265625,cpu:4                                   |
| memory     | OK     | max:1820M,total:251M,used:141M,free:110M               |
| registry   | OK     | 127.0.0.1:2181(connected)                              |
| server     | OK     | /192.168.63.127:20880(clients:1)                       |
| summary    | OK     |                                                        |
+------------+--------+--------------------------------------------------------+

dubbo>quit
Unsupported command: quit
dubbo>exit
Connection closed by foreign host.

dubbo 版本 2.7.5

@chickenlj 不知道什么时候修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants