Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
问题描述:在做Dubbo入门的时候,访问消费方的Controller报错了以上的错误。
下图是服务提供方的service实现类,并没有添加dubbo的@Service注解
当然处理这个问题,还要看在服务提供方的报错:zookeeper没连接上呢
开启zookeeper的服务
如果还是不能解决,看看防火墙是否关闭
我用的是centos6.7,关闭防火墙:service iptables stop
总结:出现:Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause这类问题
要注意以下几点:
1、服务提供方的@Service注解是否漏写,导错包(导入Dubbo下的包)
2、消费方的@Reference注解是否漏写,导错包(导入Dubbo下的包)
3、注册中心的zookeeper是否开启服务
4、防火墙是否关闭或允许服务提供方配置协议的端口(默认20880)通过