Metrics
0
Watch 2.6k Star 5.2k Fork 2.6k

ThinkGem / JeeSite 4.xJavaAGPL-3.0

多数据源配置问题Undetermined error occurred in the underlying Connection - check your data for consistency

Open
半岛铁盒  Created at

该问题是怎么引起的?

找不到,感觉配置的没问题,启动不报错,切换另一个数据库的时候就报错了,另外,另一个数据库是只读权限,是不是这个原因

重现步骤

数据库连接

jdbc:

Mysql 数据库配置

type: mysql
driver: com.mysql.jdbc.Driver

url: jdbc:mysql://localhost:3306/potevio_tools?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
username: root
password: root

多数据源名称列表,启用方式:@MyBatisDao(dataSourceName="ds2")

dataSourceNames: ds2,ds3,ds4,ds5,ds6,ds7,ds8,ds9,ds10

多数据源配置:ds2

ds2:
type: mssql
driver: net.sourceforge.jtds.jdbc.Driver
url: jdbc:jtds:sqlserver://xxxxxx:1433/card_mark
username: xxxx
password: xxxx
testSql: SELECT 1 FROM DUAL
encrypt:
username: false
password: true
pool:
init: 1
minIdle: 3
maxActive: 20
ds10:
type: mysql
driver: com.mysql.jdbc.Driver
url: jdbc:mysql://xxxxxx:8066/crm?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true
username: xxxx
password: xxxx
testSql: SELECT 1
encrypt:
username: false
password: true
pool:
init: 1
minIdle: 3
maxActive: 20

报错信息

05-14 18:44:58.832 WARN [com.atomikos.datasource.xa.XATransactionalResource] - Error in recovery
com.mysql.jdbc.jdbc2.optional.MysqlXAException: Undetermined error occurred in the underlying Connection - check your data for consistency
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:586)
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.recover(MysqlXAConnection.java:316)
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.recover(MysqlXAConnection.java:244)
at com.atomikos.datasource.xa.XATransactionalResource.recoverXidsFromXAResource(XATransactionalResource.java:554)
at com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:512)
at com.atomikos.datasource.xa.XATransactionalResource.recoverXidsFromResourceIfNecessary(XATransactionalResource.java:615)
at com.atomikos.datasource.xa.XATransactionalResource.endRecovery(XATransactionalResource.java:583)
at com.atomikos.icatch.imp.TransactionServiceImp.recover(TransactionServiceImp.java:558)
at com.atomikos.datasource.xa.XATransactionalResource.setRecoveryService(XATransactionalResource.java:435)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

Caused by: java.sql.SQLException: User readonly
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2480)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2438)
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1381)
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.recover(MysqlXAConnection.java:295)
... 145 common frames omitted
05-14 18:44:58.835 WARN [com.atomikos.icatch.imp.TransactionServiceImp] - ERROR IN RECOVERY
com.atomikos.datasource.ResourceException: Error in recovery
at com.atomikos.datasource.xa.XATransactionalResource.recoverXidsFromXAResource(XATransactionalResource.java:565)
at com.atomikos.datasource.xa.XATransactionalResource.recover(XATransactionalResource.java:512)
at com.atomikos.datasource.xa.XATransactionalResource.recoverXidsFromResourceIfNecessary(XATransactionalResource.java:615)
at com.atomikos.datasource.xa.XATransactionalResource.endRecovery(XATransactionalResource.java:583)
at com.atomikos.icatch.imp.TransactionServiceImp.recover(TransactionServiceImp.java:558)
at com.atomikos.datasource.xa.XATransactionalResource.setRecoveryService(XATransactionalResource.java:435)
at com.atomikos.icatch.system.Configuration.addResource(Configuration.java:386)
at com.atomikos.jdbc.AtomikosDataSourceBean.doInit(AtomikosDataSourceBean.java:201)
at com.atomikos.jdbc.AbstractDataSourceBean.init(AbstractDataSourceBean.java:296)
at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:339)
at com.atomikos.jdbc.AbstractDataSourceBean.getConnection(AbstractDataSourceBean.java:394)
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)
at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:82)
at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:68)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

05-14 18:45:01.011 DEBUG [o.m.spring.transaction.SpringManagedTransaction] - JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@668c9e28] will be managed by Spring
05-14 18:45:01.013 DEBUG [c.j.m.potevio.dao.BfBalanceSourceTDao.findList] - ==> Preparing: select card_id as cardNo, supply_trans_seq_no, oper_date, accept_channel, amount*100 as amount from bf_balance_source_t_10178045
05-14 18:45:01.067 WARN [com.atomikos.datasource.xa.XAResourceTransaction] - XA resource 'ds10': resume for XID '322E302E312E322E746D30303033343030303035:322E302E312E322E746D3332' raised -7: the XA resource has become unavailable
com.mysql.jdbc.jdbc2.optional.MysqlXAException: Undetermined error occurred in the underlying Connection - check your data for consistency
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.mapXAExceptionFromSQLException(MysqlXAConnection.java:586)
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.dispatchCommand(MysqlXAConnection.java:568)
at com.mysql.jdbc.jdbc2.optional.MysqlXAConnection.start(MysqlXAConnection.java:509)
at com.atomikos.datasource.xa.XAResourceTransaction.resume(XAResourceTransaction.java:427)
at com.atomikos.datasource.xa.session.BranchEnlistedStateHandler.(BranchEnlistedStateHandler.java:59)
at com.atomikos.datasource.xa.session.NotInBranchStateHandler.checkEnlistBeforeUse(NotInBranchStateHandler.java:64)
at com.atomikos.datasource.xa.session.TransactionContext.checkEnlistBeforeUse(TransactionContext.java:88)
at com.atomikos.datasource.xa.session.SessionHandleState.notifyBeforeUse(SessionHandleState.java:179)
at com.atomikos.jdbc.AtomikosConnectionProxy.enlist(AtomikosConnectionProxy.java:223)
at com.atomikos.jdbc.AtomikosConnectionProxy.invoke(AtomikosConnectionProxy.java:142)
at com.sun.proxy.$Proxy146.prepareStatement(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55)
at com.sun.proxy.$Proxy123.prepareStatement(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87)
at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59)
at sun.reflect.GeneratedMethodAccessor153.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.jeesite.common.mybatis.interceptor.PaginationInterceptor.intercept(ni:111)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy121.prepare(Unknown Source)
at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83)
at sun.reflect.GeneratedMethodAccessor170.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.jeesite.common.mybatis.interceptor.DataSourceInterceptor.intercept(tf:80)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
at com.sun.proxy.$Proxy120.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)

2339039_bei3ke total 2 participants

Comments (3)

2339039_bei3ke
bei3ke 2019-05-15 11:52

检查一下yml是是不是没写对,这个格式很严格的。

2339039_bei3ke
bei3ke 2019-05-15 11:53

是不是地址写错了,可以和默认数据源换配置看看

半岛铁盒 2019-05-17 09:42

@bei3ke 应该是数据库的限制,我别的数据库都能连上,配多数据源没问题,最后没办法,我直接用jdbc单独连的这个库

Sign in and comment

Assignee
Labels
Not set
Project
Milestone
Branch
Scheduled start
Not set
Scheduled end
Not set
Top level
Priority

Help Search