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)通过

在尝试使用Dubbo进行服务调用时,遇到Servlet.service()异常,具体为'Request processing failed; nested exception is java.lang.NullPointerException'。问题源于服务提供方未添加@Service注解,也可能涉及Zookeeper连接问题。解决方案包括检查服务提供方@Service注解,确保导入正确Dubbo包,启动Zookeeper服务,关闭或配置防火墙允许20880端口通信。
最低0.47元/天 解锁文章
889





