【异常】java.sql.SQLException: Could not retrieve transaction read-only status from server Query
1 详细异常
java.sql.SQLException: Could not retrieve transaction read-only status from server Query: replace into wm_offsets (`group_id`, `topic`, `partition_id`, `offset`) values(?,?,?,?) Parameters: [[ChargingOrderRealTimeStatistics, maxwell, 0, 4608134], [ChargingOrderRealTimeStatistics, maxwell, 1, 4564556], [ChargingOrderRealTimeStatistics, maxwell, 2, 4538179]] at org.apache.commons.dbutils.AbstractQueryRunner.rethrow(AbstractQueryRunner.java:527) at org.apache.commons.dbutils.QueryRunner.batch(QueryRunner.java:195) at org.apache.commons.dbutils.QueryRunner.batch(QueryRunner.java:151) at com.*****.common.mysql.dao.OffsetManager$.saveOffset2MySQLByGroup(OffsetManager.scala:61) at com。***.spark.streaming.ChargingOrderRealTimeStatisticsEtl$$anonfun$main$1.apply(ChargingOrderRealTimeStatisticsEtl.scala:191) at com.*******.spark.streaming.ChargingOrderRealTimeStatisticsEtl$$anonfun$main$1.apply(ChargingOrderRealTimeStatisticsEtl.scala:107) at org.apache.spark.streaming.dstream.DStream$$anonfun$foreachRDD$1$$anonfun$apply$mcV$sp$3.apply(DStream.scala:628) at org.apache.spark.streaming.dstream.DStream$$anonfun$foreachRDD$1$$anonfun$apply$mcV$sp$3.apply(DStream.scala:628) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1$$anonfun$apply$mcV$sp$1.apply(ForEachDStream.scala:51) at org.apache.spark.streaming.dstream.DStream.createRDDWithLocalProperties(DStream.scala:416) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply$mcV$sp(ForEachDStream.scala:50) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply(ForEachDStream.scala:50) at org.apache.spark.streaming.dstream.ForEachDStream$$anonfun$1.apply(ForEachDStream.scala:50) at scala.util.Try$.apply(Try.scala:192) 看报错感觉是事务问题 https://de
2 解决方案
看报错感觉是事务问题
mysql5.7推荐的驱动是8.0的
1 查询网上的说法,修改了事务级别,但是不起作用
2 根据官方mysql的推荐,更新的mysql驱动版本到8.0.7 解决问题