1. 程式人生 > 實用技巧 >springboot整合dubbo啟動遇到空指標異常

springboot整合dubbo啟動遇到空指標異常

遇到的錯誤:

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

這個問題一般都是攔截器或者controller註解有問題,我在呼叫zookeeper註冊中心的@Reference註解導錯了包,應該是org.apache.dubbo.config.annotation.Reference

在這裡插入圖片描述

還要注意:伺服器端的@Service 註解應該是匯入org.apache.dubbo.config.annotation.Service這個包,客戶端的@Service 則是org.springframework.stereotype.Service這個包,導錯了包就會空指標。