Closed Yule-Momoko closed 2 years ago
@Yule-Momoko Hi, sorry for late reply, can you provide your configration? sharding or other feature?
@Yule-Momoko嗨,抱歉回复晚了,你能提供你的配置吗?分片或其他功能?
Configure read/write separation only
Caused by: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:85) at com.mysql.cj.jdbc.ClientPreparedStatement.setObject(ClientPreparedStatement.java:1671) at com.alibaba.druid.pool.DruidPooledPreparedStatement.setObject(DruidPooledPreparedStatement.java:480) at org.apache.shardingsphere.driver.jdbc.adapter.AbstractPreparedStatementAdapter.lambda$addParameters$0(AbstractPreparedStatementAdapter.java:289) at org.apache.shardingsphere.driver.jdbc.adapter.AbstractPreparedStatementAdapter.replaySetParameter(AbstractPreparedStatementAdapter.java:281) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.replaySetParameter(ShardingSpherePreparedStatement.java:415) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.replay(ShardingSpherePreparedStatement.java:407) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.cacheStatements(ShardingSpherePreparedStatement.java:403) at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:297) at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47) at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74) at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50) at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117) at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76) at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197) ... 112 common frames omitted Caused by: com.mysql.cj.exceptions.WrongArgumentException: Invalid argument value: java.io.NotSerializableException at sun.reflect.GeneratedConstructorAccessor164.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) at com.mysql.cj.AbstractQueryBindings.setSerializableObject(AbstractQueryBindings.java:794) at com.mysql.cj.AbstractQueryBindings.setObject(AbstractQueryBindings.java:236) at com.mysql.cj.jdbc.ClientPreparedStatement.setObject(ClientPreparedStatement.java:1669) ... 125 common frames omitted Caused by: java.io.NotSerializableException: java.io.ByteArrayInputStream at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) at com.mysql.cj.AbstractQueryBindings.setSerializableObject(AbstractQueryBindings.java:783) ... 127 common frames omitted
@Yule-Momoko Hello, I used MySQL 5.7 and 8.x versions, and the Druid/Hikari connection pool for testing, but this exception cannot be reproduced. The following is the configuration I tested:
dataSources:
write_0:
# dataSourceClassName: com.zaxxer.hikari.HikariDataSource
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
# driverClassName: com.mysql.jdbc.Driver
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
# jdbcUrl: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
username: root
password: 123456
maxWait: 60
maxActive: 20
read_0:
# dataSourceClassName: com.zaxxer.hikari.HikariDataSource
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
# driverClassName: com.mysql.jdbc.Driver
driverClassName: com.mysql.cj.jdbc.Driver
# jdbcUrl: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
username: root
password: 123456
maxWait: 60
maxActive: 20
read_1:
# dataSourceClassName: com.zaxxer.hikari.HikariDataSource
dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
# driverClassName: com.mysql.jdbc.Driver
driverClassName: com.mysql.cj.jdbc.Driver
# jdbcUrl: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
url: jdbc:mysql://127.0.0.1:3306/write_0?serverTimezone=UTC&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&allowPublicKeyRetrieval=true
username: root
password: 123456
maxWait: 60
maxActive: 20
rules:
- !READWRITE_SPLITTING
dataSources:
pr_ds:
writeDataSourceName: write_0
readDataSourceNames:
- read_0
- read_1
CREATE DATABASE write_0;
USE write_0;
CREATE TABLE test(id INT(1) PRIMARY KEY, content LONGBLOB);
execute(dataSource, "INSERT INTO test(id, content) VALUES(?, ?), (?, ?);", false, Arrays.asList(1, "11", 2, "22"));
In addition, from your log, it should be that Druid throws an exception because the parameter does not implement serializable interface. @Yule-Momoko So please double check your business code.
Since there is no reply for a long time, I will close this issue. If there is still a problem, please submit issue feedback, thank you.
Bug Report
For English only, other languages will not accept.
Before report a bug, make sure you have:
Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will close it.
Please answer these questions before submitting your issue. Thanks!
Which version of ShardingSphere did you use?
5.0.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
Actual behavior
Error saving longblob field type Caused by: com.mysql.cj.exceptions.WrongArgumentException: Invalid argument value: java.io.NotSerializableException
Reason analyze (If you can)
longblob field type Can't save
Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
rg.apache.ibatis.exceptions.PersistenceException:
Error updating database. Cause: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
The error may exist in org/activiti/db/mapping/entity/Comment.xml
The error may involve org.activiti.engine.impl.persistence.entity.CommentEntity.insertComment-Inline
The error occurred while setting parameters
SQL: insert into ACT_HICOMMENT (ID, TYPE, TIME, USERID, TASKID, PROC_INSTID, ACTION, MESSAGE, FULLMSG) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
Cause: java.sql.SQLException: Invalid argument value: java.io.NotSerializableException
Example codes for reproduce this issue (such as a github link).