一、问题现象
客户端通过dubbo协议调用注册服务时,报出BeanCreationException异常,具体异常轨迹如下:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionManager': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.xx.portal.rpc.service.ISessionManager. No provider available for the service com.ekache.portal.rpc.service.ISessionManager from the url zookeeper://xxx.xx.x.xx:2181/com.alibaba.dubbo.registry.RegistryService?application=bss-provider-soa&dubbo=2.5.3&interface=com.ekache.portal.rpc.service.ISessionManager&methods=get&pid=13756&side=consumer×tamp=1445766478466 to the consumer 172.168.1.4 use dubbo version 2.5.3@b@ at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)@b@ at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1517)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)@b@ at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)@b@ at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)@b@ at com.xx.portal.rpc.service.Test.main(Test.java:15)@b@Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.xx.portal.rpc.service.ISessionManager. No provider available for the service com.xx.portal.rpc.service.ISessionManager from the url zookeeper://xxx.xxx.x.xx:2181/com.alibaba.dubbo.registry.RegistryService?application=bss-provider-soa&dubbo=2.5.3&interface=com.ekache.portal.rpc.service.ISessionManager&methods=get&pid=13756&side=consumer×tamp=1445766478466 to the consumer 172.168.1.4 use dubbo version 2.5.3@b@ at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)@b@ at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)@b@ at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)@b@ at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:65)@b@ at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
二、解决步骤
造成上述问题原因是,服务端ISesssionManager的包路径与客户端ISessionManager定义包路径不统一,修改为统一个包路径名称(如都改为"com.xx.portal.rpc.service"),问题就解决了.