Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processin

问题描述

Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException

原因一

导包导错

@Reference导包错误!错误包: import jdk.nashorn.internal.ir.annotations.Reference;

正确包:

import com.alibaba.dubbo.config.annotation.Reference;

原因二

    Service层实现类未添加注解@Autowired

    controller层没有加@ResponseBody

原因三

注意看看扫描包路径对不对

    <!-- 扫描指定包,加入@Service注解的类会被发布为服务  -->
    <dubbo:annotation package="com.atguigu.service" />

猜你喜欢

转载自blog.csdn.net/weixin_45905210/article/details/121328123