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