java.sql.SQLException: Connection is read-only. Queries leading to data modification are not

产生的原因:
事务中查询的方法中,嵌套了新增或修改的方法,会报该异常。
解决方法:
找到报错的方法,在该方法上加上注解,@Transactional(readOnly = false)

业务上加了事务控制,意思是只能查询不能增加、修改或者删除,如果需要执行的这个操作,则需要修改事务的控制
将事务控制的readOnly的值改成false即可

DEMO:
@Transactional(readOnly = false) //加上这个注解
public void saveLog(ProceedingJoinPoint joinPoint, long time, Object proceed) { }

java.sql.SQLException: Connection is read-only. Queries leading to data modification are not的更多相关文章

  1. java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

    org.springframework.dao.TransientDataAccessResourceException: ### Error updating database. Cause: ja ...

  2. [Done]java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

    java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed ...

  3. java.sql.SQLException: connection holder is null;

    一.问题来源分析 出现的错误 : Cause: java.sql.SQLException: connection holder is null; uncategorized SQLException ...

  4. java.sql.SQLException: connection holder is null 问题处理

    问题描述 上上个周测试的时候突然报系统异常,于是我立即查看日志,发现是一个数据库异常:java.sql.SQLException: connection holder is null我第一想到的就是可 ...

  5. java最全的Connection is read-only. Queries leading to data modification are not allowed

    Connection is read-only. Queries leading to data modification are not allowed 描述:框架注入时候,配置了事物管理,权限设置 ...

  6. Connection is read-only. Queries leading to data modification are not allowed

    看了下mysql-connector-5.1.40版本中,如果设置failoverReadOnly=true (即默认值,参考链接),当mysql连接failover时,会根据jdbc连接串将当前连接 ...

  7. 执行update操作的话,就会报“Connection is read-only. Queries leading to data modification are not allowed”的异常。

    我用的是 spring + springmvc + mybatis +mysql. <tx:advice id="txAdvice" transaction-manager= ...

  8. 详细解读 :java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed,Java报错之Connection is read-only.

    问题分析: 实际开发项目中,进行insert的时候,产生这个问题是Spring框架的一个安全权限保护方法,对于方法调用的事物保护,一般配置如下: <!-- 事务管理 属性 --> < ...

  9. 开发中遇到的Cause: java.sql.SQLException: connection holder is null的异常

    异常的出现是属于获取连接超时,从而找不到持有者. 项目中的配置体现: <property name="removeAbandoned" value="true&qu ...

  10. Connection is read-only. Queries leading to data modification are not allowed 错误原因

    因为我再spring 中使用了AOP进行事务管理,有如下配置 <tx:advice id="txAdvice" transaction-manager="trans ...

随机推荐

  1. 如何使用 PTS 快速发起微服务压测

    ​简介:本文讲阐述什么是微服务架构.微服务架构对系统稳定性带来的影响,以及用性能测试验证稳定性的必要性.用户进行微服务压测的痛点和 PTS 的独特优势.云上使用 PTS 快速发起微服务压测的步骤,以及 ...

  2. Spring Cloud Bus 消息总线介绍

    简介: 本文配套可交互教程已登录阿里云知行动手实验室,PC 端登录 start.aliyun.com 在浏览器中立即体验. 作者 | 洛夜来源 | 阿里巴巴云原生公众号 本文配套可交互教程已登录阿里云 ...

  3. [FAQ] 没有docker用户组,怎么让普通用户有权限操作docker

      如果没有docker用户组,可以通过以下步骤让普通用户有权限操作docker: 创建一个名为docker的用户组: sudo groupadd docker 将当前用户添加到docker用户组中: ...

  4. [FAQ] Truffle Deployer 合约传参问题: Invalid number of parameters for "undefined". Got 0 expected 1!

    在使用 `truffle migrate` 时,如果合约的构造函数需要传参,而部署脚本里没有传的时候,就会报这个错. 未传参时: const Migrations = artifacts.requir ...

  5. [Ethereum] 浅谈 ERC20 在 openzeppelin-contracts 中的结构与实现

    目前 openzeppelin-contracts 的稳定版是 v2.5,截止到本文发布,最新的 Tag 为 v3.0.0-rc.0 以下是 token/ETC20 的文件列表: IERC20.sol ...

  6. Raft 共识算法4-选举限制

    Raft 共识算法4-选举限制 Raft算法中译版地址:https://object.redisant.com/doc/raft中译版-2023年4月23日.pdf 英原论文地址:https://ra ...

  7. RT-Thread 堆区大小设置

    一.利用栈区的空间作为堆区 看过我之前的笔记的小伙伴都知道,以前我是通过申请栈区的空间使用的,感兴趣的小伙伴可以看我之前的笔记,RT-Thread移植到stm32. 在board.c文件文件中的代码如 ...

  8. 【python爬虫案例】用python爬豆瓣读书TOP250排行榜!

    目录 一.爬虫对象-豆瓣读书TOP250 二.python爬虫代码讲解 三.讲解视频 四.完整源码 一.爬虫对象-豆瓣读书TOP250 今天我们分享一期python爬虫案例讲解.爬取对象是,豆瓣读书T ...

  9. 开源电子邮件营销平台 listmonk 使用教程

    做产品肯定要做电子邮件营销,特别是面向海外的产品,电子邮件营销已成为企业与客户沟通.建立品牌忠诚度和推动销售的重要工具,可以直接接触到目标受众,提供个性化内容,并以相对较低的成本获得可观的投资回报.你 ...

  10. Git reset 的hard、soft、mixed参数对比

    目录 分区概念 1. --soft参数 2. --mixed参数 3. --hard参数 分区概念 先要清楚在本地,git会分三个区:工作区.暂存区.本地库. 当使用去做版本移动的时候,那么在使用[- ...