liubo-tech opened a new issue #3124: when using binding-table,error occurred URL: https://github.com/apache/incubator-shardingsphere/issues/3124 My application.properties is : `spring.shardingsphere.sharding.binding-tables=t_order,t_order_item` It's error : ``` Caused by: java.lang.NullPointerException at org.apache.shardingsphere.core.rule.ShardingRule.isBroadcastTable(ShardingRule.java:292) at org.apache.shardingsphere.core.rule.ShardingRule.getTableRule(ShardingRule.java:186) at org.apache.shardingsphere.core.rule.ShardingRule.createBindingTableRule(ShardingRule.java:114) at org.apache.shardingsphere.core.rule.ShardingRule.createBindingTableRules(ShardingRule.java:106) at org.apache.shardingsphere.core.rule.ShardingRule.<init>(ShardingRule.java:81) at org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory.createDataSource(ShardingDataSourceFactory.java:50) at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration.shardingDataSource(SpringBootConfiguration.java:96) at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$eb1f0297.CGLIB$shardingDataSource$1(<generated>) at org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$eb1f0297$$FastClassBySpringCGLIB$$348b8c97.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ``` In method `isBroadcastTable`, `broadcastTables` is null. Please use `Assert.notNull()`. Additional,change position of `bindingTableRules` and `broadcastTables` In `ShardingRule` construct method. ``` public ShardingRule(final ShardingRuleConfiguration shardingRuleConfig, final Collection<String> dataSourceNames) { Preconditions.checkArgument(null != shardingRuleConfig, "ShardingRuleConfig cannot be null."); Preconditions.checkArgument(null != dataSourceNames && !dataSourceNames.isEmpty(), "Data sources cannot be empty."); this.ruleConfiguration = shardingRuleConfig; shardingDataSourceNames = new ShardingDataSourceNames(shardingRuleConfig, dataSourceNames); tableRules = createTableRules(shardingRuleConfig); **bindingTableRules** = createBindingTableRules(shardingRuleConfig.getBindingTableGroups()); **broadcastTables** = shardingRuleConfig.getBroadcastTables(); defaultDatabaseShardingStrategy = createDefaultShardingStrategy(shardingRuleConfig.getDefaultDatabaseShardingStrategyConfig()); defaultTableShardingStrategy = createDefaultShardingStrategy(shardingRuleConfig.getDefaultTableShardingStrategyConfig()); defaultShardingKeyGenerator = createDefaultKeyGenerator(shardingRuleConfig.getDefaultKeyGeneratorConfig()); masterSlaveRules = createMasterSlaveRules(shardingRuleConfig.getMasterSlaveRuleConfigs()); encryptRule = createEncryptRule(shardingRuleConfig.getEncryptRuleConfig()); } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
