问题:项目在使用java -jar 启动每个jar包时,项目可正常访问,但要改为使用脚本,启动时,程序就报这个错了

nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException: dynamic-datasource can not find primary datasource ### Cause: com.baomidou.dynamic.datasource.exception.CannotFindDataSourceException: dynamic-datasource can not find primary datasource

springcloud项项目使用脚本启动.sh,报错nested exception is org.apache.ibatis.exceptions.PersistenceException: ###_重启

莫名奇妙。

修复方式:

在nacos的服务配置中,修改数据源的链接,在最后面追加下面这行内容,保存配置重启项目就好了

&rewriteBatchedStatements=true

rewriteBatchedStatements 开启 / 关闭 速度对比

springcloud项项目使用脚本启动.sh,报错nested exception is org.apache.ibatis.exceptions.PersistenceException: ###_java_02

感觉出现的问题解决与此项比太符合,搞不清楚,但至少问题解决了