Cannot find table rule and default data source with logic tables: '[]'
报的异常信息如下:
com.dangdang.ddframe.rdb.sharding.exception.ShardingJdbcException: Cannot find table rule and default data source with logic tables: '[]'
at com.dangdang.ddframe.rdb.sharding.routing.type.complex.ComplexRoutingEngine.route(ComplexRoutingEngine.java:81)
at com.dangdang.ddframe.rdb.sharding.routing.router.ParsingSQLRouter.route(ParsingSQLRouter.java:123)
at com.dangdang.ddframe.rdb.sharding.routing.router.ParsingSQLRouter.route(ParsingSQLRouter.java:89)
at com.dangdang.ddframe.rdb.sharding.routing.PreparedStatementRoutingEngine.route(PreparedStatementRoutingEngine.java:56)
at com.dangdang.ddframe.rdb.sharding.jdbc.core.statement.ShardingPreparedStatement.route(ShardingPreparedStatement.java:120)
at com.dangdang.ddframe.rdb.sharding.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:84)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
at org.hibernate.loader.Loader.doQuery(Loader.java:674)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
配置如下:
<rdb:strategy id="tableStrategy" sharding-columns="TIME" algorithm-class="com.util.parse.TableShardingAlgorithm"/> <rdb:data-source id="shardingdataSource"> <rdb:sharding-rule data-sources="ds_01" default-data-source="generalDataSource"> <rdb:table-rules> <rdb:table-rule logic-table="audit_record" dynamic="true" table-strategy="tableStrategy"/> </rdb:table-rules> <rdb:binding-table-rules> <rdb:binding-table-rule logic-tables="audit_record"/> </rdb:binding-table-rules> <rdb:default-database-strategy sharding-columns="none" algorithm-class="com.dangdang.ddframe.rdb.sharding.api.strategy.database.NoneDatabaseShardingAlgorithm"/> </rdb:sharding-rule> <rdb:props> <prop key="metrics.enable">true</prop> </rdb:props> </rdb:data-source>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我用的是1.5.0, 升级到1.5.3就没这个问题了
这个应该是1.5.2版本的bug,已经在1.5.3修复。
issue:https://github.com/dangdangdotcom/sharding-jdbc/issues/351