You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "kexianjun (GitHub)" <gi...@apache.org> on 2018/12/21 17:47:28 UTC
[GitHub] [incubator-dubbo-website] kexianjun commented on pull request #200: Modify the documentation about the Telnet command to match the code impl…
> I ran the following command on latest 2.7.x branch and got following error
>
> ```
> dubbo>invoke org.apache.dubbo.demo.DemoService.sayHello("hello") -p java.lang.String
> Invalid parameters, format: service.method(args)
> ```
> It looks like `-p java.lang.String` does not work. How did you get it to work?
I have made more test on the latest master branch.My test is as the following:
```
package org.apache.dubbo.demo;
public class Student {
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
```
```
package org.apache.dubbo.demo;
public interface DemoService {
String sayHello(String name);
String sayHello(Long name);
String sayHello(Integer age);
String sayHello(Student student);
String sayHello(String name, Integer age);
}
```
```
package org.apache.dubbo.demo.provider;
import org.apache.dubbo.demo.DemoService;
import org.apache.dubbo.demo.Student;
import org.apache.dubbo.rpc.RpcContext;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DemoServiceImpl implements DemoService {
@Override
public String sayHello(String name) {
System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] Hello " + name + ", request from consumer: " + RpcContext.getContext().getRemoteAddress());
return "Hello " + name + ", response from provider: " + RpcContext.getContext().getLocalAddress();
}
@Override
public String sayHello(Long name) {
return "Long from sayHello " + name;
}
@Override
public String sayHello(Integer age) {
return "int from sayHello " + age;
}
@Override
public String sayHello(Student student) {
return "Student from sayHello ,name:" + student.getName() + ",age:" + student.getAge();
}
@Override
public String sayHello(String name, Integer age) {
return "name and age from sayHello,name:" + name + ",age" + age;
}
}
```
here is my result:
![image](https://user-images.githubusercontent.com/12162539/50355916-291efb00-058b-11e9-9163-d06ccffcb2b7.png)
![image](https://user-images.githubusercontent.com/12162539/50355940-3d62f800-058b-11e9-8a7d-5e6e2d4ca01b.png)
And based on your result,the error message from org/apache/dubbo/rpc/protocol/dubbo/telnet/InvokeTelnetHandler.java:158
```
if (i < 0 || !message.endsWith(")")) {
return "Invalid parameters, format: service.method(args)";
}
```
it may indicate something wrong with the input parentheses.Would you maind to take a look at this and provide more detail about your test?
[ Full content available at: https://github.com/apache/incubator-dubbo-website/pull/200 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org