You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "yinjunonly (GitHub)" <gi...@apache.org> on 2019/09/10 08:30:41 UTC

[GitHub] [dubbo] yinjunonly opened issue #5041: No matter how I set it, the version is always 0.0.0

### Environment
* Dubbo version: 2.7.3
* Operating System version: windows10
* Java version: 8

### Steps to reproduce this issue
1.Declare  service:
```xml
<dubbo:service interface="com.xxx.RemoteDefaultService" version="0.0.1" timeout="5000" ref="remoteDefaultServiceImpl" group="commonComponent"/>
```
2.Generalizing calls using API
```java
ReferenceConfig<GenericService> reference = new ReferenceConfig<GenericService>();
reference.setApplication(this.applicationConfig);
reference.setRegistry(this.registryConfig);
reference.setInterface("com.xxx.RemoteDefaultService");
reference.setGeneric(true);
reference.setConsumer(consumerConfig);
reference.setGroup("commonComponent");
reference.setVersion("0.0.1");
ReferenceConfigCache cache = ReferenceConfigCache.getCache();
GenericService genericService = cache.get(reference);
int len = params.size();
String[] invokeParamTyeps = new String[len];
Object[] invokeParams = new Object[len];
for (int i = 0; i < len; i++) {
	GenericParamsEntity current = params.get(i);
	invokeParamTyeps[i] = current.getTypeName();
	invokeParams[i] = current.getValue();
}
try {
	Object result = genericService.$invoke(method, invokeParamTyeps, invokeParams);
	return result;
} catch (GenericException e) {
	genericExceptionAnalytical(e);
	throw e;
}
```
3.Throw an exception
```java
Not found exported service: 
········································································
·········································································
interface=com.shxhome.hopps.common.core.microservice.defaultservice.RemoteDefaultService, version=0.0.0, generic=true}]
```
**No matter how I set it, the version is always 0.0.0**


[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] bq-xiao commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "bq-xiao (GitHub)" <gi...@apache.org>.
**the same issue:**

Env:
```
maven:
<dependency>
            <groupId>org.apache.dubbo</groupId>
            <artifactId>dubbo-spring-boot-starter</artifactId>
            <version>2.7.3</version>
</dependency>

OS: windows10
JDK:1.8
```

1.Provider source code:
```
@Service(version = "demo", interfaceClass = HelloWorldService.class)
public class HelloWorldServiceImpl implements HelloWorldService {

    @Value("${dubbo.application.name}")
    private String serviceName;

    @Override
    public String sayHello(String name) {
        return String.format("[%s] : Hello, %s", serviceName, name);
    }
}
```

2.Consumer source code:
```
@RestController
@RequestMapping("/sample")
public class HelloWorldController {
    @Reference(version = "demo", url = "dubbo://127.0.0.1:12345")
    private HelloWorldService helloWorldService;

    @GetMapping(value = "/hello/{name}")
    @ResponseBody
    public String say(@PathVariable("name") String name) {
        return helloWorldService.sayHello(name);
    }
}
```
3.But get below error log
```
org.apache.dubbo.remoting.RemotingException: org.apache.dubbo.remoting.RemotingException: Not found exported service: com.example.dubbo.springboot.api.service.HelloWorldService:12345 in [com.example.dubbo.springboot.api.service.HelloWorldService:demo:12345], may be version or group mismatch , channel: consumer: /192.168.0.190:9410 --> provider: /192.168.0.190:12345, message:RpcInvocation [methodName=sayHello, parameterTypes=[class java.lang.String], arguments=[aa], attachments={path=com.example.dubbo.springboot.api.service.HelloWorldService, input=270, dubbo=2.0.2, interface=com.example.dubbo.springboot.api.service.HelloWorldService, version=0.0.0}]
org.apache.dubbo.remoting.RemotingException: Not found exported service: com.example.dubbo.springboot.api.service.HelloWorldService:12345 in [com.example.dubbo.springboot.api.service.HelloWorldService:demo:12345], may be version or group mismatch , channel: consumer: /192.168.0.190:9410 --> provider: /192.168.0.190:12345, message:RpcInvocation [methodName=sayHello, parameterTypes=[class java.lang.String], arguments=[aa], attachments={path=com.example.dubbo.springboot.api.service.HelloWorldService, input=270, dubbo=2.0.2, interface=com.example.dubbo.springboot.api.service.HelloWorldService, version=0.0.0}]
```


[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] bq-xiao commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "bq-xiao (GitHub)" <gi...@apache.org>.
> I have a demo locally. It works fine.
> Do you have a demo git repository link?

@sonymoon Yes, i init a pubic repository, you can reference this link: [dubbo-demo](https://github.com/bq-xiao/dubbo-demo)

And, i reference this guideline [dubbo-spring-boot-project](https://github.com/apache/dubbo-spring-boot-project)

[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] chickenlj commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "chickenlj (GitHub)" <gi...@apache.org>.
用的是什么注册中心?请检查注册中心中 provider url 注册上去的 group version 值是什么?

另外贴一些日志,看看注册中心实际下发下来的 url 是什么,然后我们才能继续定位问题

[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [dubbo] chickenlj commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "chickenlj (GitHub)" <gi...@apache.org>.
Reopen if necessary.

[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] sonymoon commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "sonymoon (GitHub)" <gi...@apache.org>.
```java
if (REGISTRY_PROTOCOL.equals(url.getProtocol())) {
     urls.add(url.addParameterAndEncoded(REFER_KEY, StringUtils.toQueryString(map)));
} else {
    urls.add(ClusterUtils.mergeUrl(url, map));
}
```

See org.apache.dubbo.rpc.cluster.support.ClusterUtils#mergeUrl.
If no registry was set, some params will be removed including `VERSION_KEY`.

@bq-xiao For your case, temp solution: you can use http://dubbo.apache.org/zh-cn/docs/user/references/registry/simple.html if you don't have any registry center.

I was wondering why these params would be removed if there is no registry. 
@htynkn Any official answers?

[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [dubbo] sonymoon commented on issue #5041: No matter how I set it, the version is always 0.0.0

Posted by "sonymoon (GitHub)" <gi...@apache.org>.
I have a demo locally. It works fine.
Do you have a demo git repository link?

[ Full content available at: https://github.com/apache/dubbo/issues/5041 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org