Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available
Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available for the service com.zbcx.demo.service.UserService from the url zookeeper
初学dubbox遇到的第一个错误,启动消费方时报此异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController' defined in file [F:\Eclipse_Projects\dubboxdemo-web\target\classes\com\zbcx\demo\web\UserController.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Failed to init remote service reference at filed userService in class com.zbcx.demo.web.UserController; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available for the service com.zbcx.demo.service.UserService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=dubboxdemo-web&dubbo=2.8.4&interface=com.zbcx.demo.service.UserService&methods=getName&pid=14112&side=consumer×tamp=1575012122973 to the consumer 192.168.2.108 use dubbo version 2.8.4
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
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:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.springframework.beans.factory.BeanInitializationException: Failed to init remote service reference at filed userService in class com.zbcx.demo.web.UserController; nested exception is java.lang.IllegalStateException: Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available for the service com.zbcx.demo.service.UserService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=dubboxdemo-web&dubbo=2.8.4&interface=com.zbcx.demo.service.UserService&methods=getName&pid=14112&side=consumer×tamp=1575012122973 to the consumer 192.168.2.108 use dubbo version 2.8.4
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessBeforeInitialization(AnnotationBean.java:253)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
... 27 more
Caused by: java.lang.IllegalStateException: Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available for the service com.zbcx.demo.service.UserService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=dubboxdemo-web&dubbo=2.8.4&interface=com.zbcx.demo.service.UserService&methods=getName&pid=14112&side=consumer×tamp=1575012122973 to the consumer 192.168.2.108 use dubbo version 2.8.4
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.AnnotationBean.refer(AnnotationBean.java:317)
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessBeforeInitialization(AnnotationBean.java:246)
... 30 more
十一月 29, 2019 3:22:03 下午 org.apache.catalina.core.StandardContext loadOnStartup
严重: Servlet threw load() exception
java.lang.IllegalStateException: Failed to check the status of the service com.zbcx.demo.service.UserService. No provider available for the service com.zbcx.demo.service.UserService from the url zookeeper://192.168.25.129:2181/com.alibaba.dubbo.registry.RegistryService?application=dubboxdemo-web&dubbo=2.8.4&interface=com.zbcx.demo.service.UserService&methods=getName&pid=14112&side=consumer×tamp=1575012122973 to the consumer 192.168.2.108 use dubbo version 2.8.4
at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:420)
at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:300)
at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:138)
at com.alibaba.dubbo.config.spring.AnnotationBean.refer(AnnotationBean.java:317)
at com.alibaba.dubbo.config.spring.AnnotationBean.postProcessBeforeInitialization(AnnotationBean.java:246)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1570)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
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:772)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:668)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:682)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:553)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:494)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
此错误原因是编写服务方servcie时,写错了注解,应该使用dubbox提供的注解,不应该用spring的service注解
**import org.springframework.stereotype.Service;**
import com.zbcx.demo.service.UserService;
@Service
public class UserServiceImpl implements UserService{
public String getName() {
// TODO Auto-generated method stub
return "zbcx";
}
}
解决办法
将service注解改为dubbo官方注解
**import com.alibaba.dubbo.config.annotation.Service;**
import com.zbcx.demo.service.UserService;
@Service
public class UserServiceImpl implements UserService{
public String getName() {
// TODO Auto-generated method stub
return "zbcx";
}
}
还没有评论,来说两句吧...