You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by GitBox <gi...@apache.org> on 2018/03/27 02:15:59 UTC

[GitHub] backkoms opened a new issue #79: The "version " parameter in @Reference annotation,cannot be replaced by Variable���

backkoms opened a new issue #79: The "version " parameter in @Reference annotation,cannot be replaced by Variable。
URL: https://github.com/apache/incubator-dubbo-spring-boot-project/issues/79
 
 
   application.properties file
   `#active profiles
   spring.profiles.active=dev
   #spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
   
   spring.session.store-type=Redis
   redis.hostname = 192.168.1.102
   redis.port = 6379
   redis.pwd = a588a026b91c424cb7fa13267eb80e96
   redis.db = 1
   
   #dubbo config
   dubbo.application.name=zhishi-springboot-rest
   dubbo.protocol=dubbo
   dubbo.reference.check=false
   dubbo.consumer.check=false
   dubbo.registry.check=false`
   
   application-dev.properties file
   `spring.aop.auto=true
   spring.aop.proxy-target-class=true
   #dubbo config
   dubbo.registry.address=zookeeper://192.168.1.165:2181
   dubbo.protocol.port=20880
   
   service.registry.version=1.1.1`
   
   
   one controller file
   
   `@RestController
   @RequestMapping("/zs/v1/base")
   public class ApiBaseDataController extends BaseController {
   
   	private final Logger log=LoggerFactory.getLogger(ApiBaseDataController.class);
   	
       /**
        * dictService:字典项
        * 
        * @since JDK 1.6
        */
       @Reference(check = false,version = "${service.registry.version}")
       DictService dictService;
       @Reference(check = false,version = "${service.registry.version}")
       VersionService versionService;
   ....}`
   
   controller files also can be scan by @componentScan。
   
   
   now throws exception below 
   
   
   `2018-03-27 10:05:14.025 [main] ERROR com.alibaba.dubbo.config.AbstractConfig -  [DUBBO] null, dubbo version: 2.0.1, current host: 192.168.1.165
   java.lang.reflect.InvocationTargetException: null
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:606)
   	at com.alibaba.dubbo.config.AbstractConfig.appendAnnotation(AbstractConfig.java:444)
   	at com.alibaba.dubbo.config.ReferenceConfig.<init>(ReferenceConfig.java:114)
   	at com.alibaba.dubbo.config.spring.ReferenceBean.<init>(ReferenceBean.java:56)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.doBuild(ReferenceBeanBuilder.java:83)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceBeanBuilder.doBuild(ReferenceBeanBuilder.java:34)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.AbstractAnnotationConfigBeanBuilder.build(AbstractAnnotationConfigBeanBuilder.java:70)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.buildReferenceBean(ReferenceAnnotationBeanPostProcessor.java:345)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.access$100(ReferenceAnnotationBeanPostProcessor.java:61)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor$ReferenceFieldElement.inject(ReferenceAnnotationBeanPostProcessor.java:323)
   	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
   	at com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor.postProcessPropertyValues(ReferenceAnnotationBeanPostProcessor.java:88)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
   	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
   	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
   	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
   	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
   	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
   	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
   	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
   	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
   	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
   	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
   	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
   	at com.zhishi.rest.ApiApplication.main(ApiApplication.java:15)
   Caused by: java.lang.IllegalStateException: Invalid version="${service.registry.version}" contain illegal charactor, only digit, letter, '-', '_' and '.' is legal.
   	at com.alibaba.dubbo.config.AbstractConfig.checkProperty(AbstractConfig.java:404)
   	at com.alibaba.dubbo.config.AbstractConfig.checkKey(AbstractConfig.java:369)
   	at com.alibaba.dubbo.config.AbstractReferenceConfig.setVersion(AbstractReferenceConfig.java:186)
   	... 32 common frames omitted`
   
   
   what's the problem? tks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services