使用shardingjdbc不需要走分库分表的逻辑也报找不到DataSourceRule?
关键配置如下:
<rdb:data-source id="shardingDataSource">
<rdb:sharding-rule data-sources="dataSourcejdbc" default-data-source="dataSourcejdbc">
<rdb:table-rules>
<rdb:table-rule logic-table="t_call_detail" dynamic="true" table-strategy="tableStrategy"/>
</rdb:table-rules>
<rdb:default-database-strategy sharding-columns="none" algorithm-class="com.dangdang.ddframe.rdb.sharding.api.strategy.database.NoneDatabaseShardingAlgorithm"/>
<rdb:default-table-strategy sharding-columns="none" algorithm-class="com.dangdang.ddframe.rdb.sharding.api.strategy.table.NoneTableShardingAlgorithm"/>
</rdb:sharding-rule>
<rdb:props>
<prop key="metrics.enable">false</prop>
</rdb:props>
</rdb:data-source>
报错信息如下:
Caused by: java.lang.IllegalStateException: Missing the rule of information_schema in DataSourceRule
at com.google.common.base.Preconditions.checkState(Preconditions.java:200)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingConnection.getConnectionInternal(ShardingConnection.java:101)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingConnection.getConnection(ShardingConnection.java:64)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.routeSQL(ShardingPreparedStatement.java:167)
at com.dangdang.ddframe.rdb.sharding.jdbc.ShardingPreparedStatement.execute(ShardingPreparedStatement.java:115)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:59)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:73)
at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:60)
at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:137)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:96)
at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:77)
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:497)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.ffzx.commerce.framework.interceptor.PaginationInterceptor.intercept(PaginationInterceptor.java:84)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)
at com.sun.proxy.$Proxy43.query(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
... 53 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不用分库分表,请不要使用sharing-jdbc,而是用spring等管理不同的数据源。把分库分表的数据源和不分的分离开