Cannot invoke method xxx() on null object


最近在學習shardingsphere分庫分表,基於springboot框架,但是運行項目的時候,報個錯:

全部錯誤信息如下

[Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error updating database.  Cause: java.lang.NullPointerException: Cannot invoke method mod() on null object
### The error may exist in com/yangy/shardingsphere/mapper/UserMapper.java (best guess)
### The error may involve com.yangy.shardingsphere.mapper.UserMapper.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO yang_user  ( name, age, sex )  VALUES  ( ?, ?, ? )
### Cause: java.lang.NullPointerException: Cannot invoke method mod() on null object] with root cause

原因

分片鍵和分片策略中的字段不一致導致

 

分片策略是基於分片鍵進行運算的


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM