liruhui opened a new issue, #24876:
URL: https://github.com/apache/shardingsphere/issues/24876

   ## 1. java Code  is correctly
   ```java
   
      public static void main(String[] args) throws SQLException, 
InterruptedException {
           Map<String, DataSource> mapSource = new HashMap<>();
           DruidDataSource bookSource  = new DruidDataSource();
           bookSource.setDriverClassName(Driver.class.getName());
           
bookSource.setUrl("jdbc:mysql://192.168.191.148:3306/db_book?serverTimezone=UTC");
           bookSource.setUsername("root");
           bookSource.setPassword("rootroot");
           DruidDataSource typeSource  = new DruidDataSource();
           typeSource.setDriverClassName(Driver.class.getName());
           
typeSource.setUrl("jdbc:mysql://192.168.191.148:3307/db_type?serverTimezone=UTC");
           typeSource.setUsername("root");
           typeSource.setPassword("rootroot");
           mapSource.put("xxxx",bookSource);
           mapSource.put("yyyy",typeSource);
           //  vertical sharding database no need to configure regular 
automatic routing.
           //  vertical sharding database no need to configure regular 
automatic routing.
           DataSource abc = 
ShardingSphereDataSourceFactory.createDataSource(mapSource, null, new 
Properties());
           Connection connection = abc.getConnection();
           String sql = String.format("insert into book 
values(%d,'%s')",System.nanoTime(), UUID.randomUUID().toString());
           String sql1 = String.format("insert into type 
values(%d,'%s')",System.nanoTime(), UUID.randomUUID().toString());
           connection.prepareStatement(sql).execute();
           Thread.sleep(1200);
           connection.prepareStatement(sql1).execute();
           connection.close();
       }
   
   ```
   ## 2. ssm+sharding-jdbc+spring-namespace  error
   ```xml
   <beans xmlns="http://www.springframework.org/schema/beans";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xmlns:context="http://www.springframework.org/schema/context"; 
xmlns:tx="http://www.springframework.org/schema/tx";
          
xmlns:shardingsphere="http://shardingsphere.apache.org/schema/shardingsphere/datasource";
          xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://www.springframework.org/schema/context 
https://www.springframework.org/schema/context/spring-context.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx.xsd 
http://shardingsphere.apache.org/schema/shardingsphere/datasource 
http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd";>
   
       <bean id="book" class="com.alibaba.druid.pool.DruidDataSource">
           <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
           <property name="url" 
value="jdbc:mysql://192.168.191.148:3306/db_book?serverTimezone=UTC"/>
           <property name="username" value="root"/>
           <property name="password" value="rootroot"/>
       </bean>
   
       <bean id="type" class="com.alibaba.druid.pool.DruidDataSource">
           <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
           <property name="url" 
value="jdbc:mysql://192.168.191.148:3307/db_type?serverTimezone=UTC"/>
           <property name="username" value="root"/>
           <property name="password" value="rootroot"/>
       </bean>
   
   <!--   vertical sharding database no need to configure regular automatic 
routing.-->
      <shardingsphere:data-source id="dataSource" data-source-names="book, 
type" />
   
       <bean id="sqlSessionFactory" 
class="org.mybatis.spring.SqlSessionFactoryBean">
           <property name="dataSource" ref="dataSource"/>
       </bean>
   
       <bean id="mapperScannerConfigurer" 
class="org.mybatis.spring.mapper.MapperScannerConfigurer">
           <property name="basePackage" value="com.shangma.cn.mapper"/>
       </bean>
   
       <bean id="transactionManager" 
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="dataSource"/>
       </bean>
   
       <tx:annotation-driven/>
   ```
   
   ## 3. error Info 
   ```java
   
   org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected 
exception parsing XML document from class path resource [spring.xml]; nested 
exception is java.lang.IllegalArgumentException: 'beanName' must not be empty
                at 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:419)
                at 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
                at 
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
                at 
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
                at 
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
                at 
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
                at 
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
                at 
org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
                at 
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
                at 
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:636)
   ```


-- 
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.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to