【记】研究Sharding-JDBC遇到的一个异常(Caused by: io.shardingsphere.core.exception.ShardingException: Cannot get uniformed table structure for `t`. The different meta data of actual tables are as follows)
一、异常信息
Caused by: io.shardingsphere.core.exception.ShardingException: Cannot get uniformed table structure for `t`. The different meta data of actual tables are as follows
异常信息提示找不到表的元数据信息,也就是找不到表,但是数据表实际已经创建。
这个异常信息网上基本搜不到有效的信息和解决方案
二、排查过程
at io.shardingsphere.core.metadata.table.executor.TableMetaDataLoader.checkUniformed(TableMetaDataLoader.java:136)
at io.shardingsphere.core.metadata.table.executor.TableMetaDataLoader.load(TableMetaDataLoader.java:68)
at io.shardingsphere.core.metadata.table.executor.TableMetaDataLoader.load(TableMetaDataLoader.java:63)
private TableMetaData load(final TableRule tableRule, final ShardingDataSourceNames shardingDataSourceNames) {
List<TableMetaData> actualTableMetaDataList = loadActualTableMetaDataList(tableRule.getActualDataNodes(), shardingDataSourceNames);
checkUniformed(tableRule.getLogicTable(), actualTableMetaDataList);
return actualTableMetaDataList.iterator().next();
}
上述为异常栈信息,通过跟踪源码的方式发现最下面load方法中的 tableRule.getActualDataNodes()返回的是t0、t1两个数据,分表的配置也是:actual-data-nodes=ds_0.t$->{0..1}
根据上述信息分析发现,配置的表是t0,t1,但是数据库实际只创建了t0表,所以抛出上述异常,再创建t1表即可解决问题
三、总结
使用第三方库遇到问题网上又找不到有效的解决方案时,可尝试通过跟踪源码的方式找到问题原因
- 93.You are using flat files as the data source for one of your data warehousing applications. To opt
- 异常:Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'--解决方法
- How to Get the Frequency Table of a Categorical Variable as a Data Frame in R
- SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 解决办法
- Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=M
- oracle共享服务器创建成功后,通过jdbc连接数被限制,报错:java.sql.SQLException: Io 异常: End of TNS data channel解决方法
- oracle共享服务器创建成功后,通过jdbc连接数被限制,报错:java.sql.SQLException: Io 异常: End of TNS data channel解决方法
- Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=M
- System.Security.Cryptography.CryptographicException: The data to be decrypted exceeds the maximum for this modulus of 128 bytes. (RSACryptoServiceProv
- “System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 错误
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile
- sql异常:nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool error Timeout waiting for idle object
- You have set Tablespace Full Metrics Threshold values for the USERS tablespace as follows: Warning (
- tomcat7配置数据源异常---Cannot create JDBC driver of class '' for connect URL 'null'
- Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'beans'.
- 20.You have set Tablespace Full Metrics Threshold values for the USERS tablespace as follows:
- : The response of the WebApplicationException cannot be utilized as the response is already committe
- CoreException: Could not get the value for parameter compilerId for plugin execution default-compile: PluginResolutionException: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1
- System.Data.SqlClient.SqlException: Cannot insert explicit value for identity column in table 'Food' when IDENTITY_INSERT is set to OFF
- 122.View the Exhibit for the structure of the STUDENT and FACULTY tables.