Cannot find table rule and default data source with logic tables: '[]'

liuhuachun 发布于 2017/09/08 11:39
阅读 697
收藏 0

报的异常信息如下:

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>
加载中
0
亮_ShardingSphere
亮_ShardingSphere

这个应该是1.5.2版本的bug,已经在1.5.3修复。

issue:https://github.com/dangdangdotcom/sharding-jdbc/issues/351

liuhuachun
liuhuachun
我用的是1.5.0, 升级到1.5.3就没这个问题了
返回顶部
顶部