You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "liruhui (via GitHub)" <gi...@apache.org> on 2023/03/29 13:40:03 UTC

[GitHub] [shardingsphere] liruhui opened a new issue, #24894: ssm+spring-namespace has a RuntimeException

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

   
   ## 1. Environmental description
   ```
   Horizontal sharding database  ssm project + spring-namespace
   ```
   ## 1.1.  dependencies
   ```xml
   
       <dependencies>
   
           <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
               <version>8.0.25</version>
           </dependency>
           <dependency>
               <groupId>org.springframework</groupId>
               <artifactId>spring-webmvc</artifactId>
               <version>5.1.9.RELEASE</version>
           </dependency>
           <dependency>
               <groupId>org.mybatis</groupId>
               <artifactId>mybatis</artifactId>
               <version>3.5.4</version>
           </dependency>
           <dependency>
               <groupId>org.mybatis</groupId>
               <artifactId>mybatis-spring</artifactId>
               <version>2.0.3</version>
           </dependency>
           <dependency>
               <groupId>org.springframework</groupId>
               <artifactId>spring-jdbc</artifactId>
               <version>5.1.9.RELEASE</version>
           </dependency>
           <dependency>
               <groupId>org.aspectj</groupId>
               <artifactId>aspectjweaver</artifactId>
               <version>1.9.6</version>
           </dependency>
           <dependency>
               <groupId>com.fasterxml.jackson.core</groupId>
               <artifactId>jackson-databind</artifactId>
               <version>2.11.4</version>
           </dependency>
           <dependency>
               <groupId>org.projectlombok</groupId>
               <artifactId>lombok</artifactId>
               <version>1.18.20</version>
           </dependency>
           
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core</artifactId>
               <version>5.2.1</version>
           </dependency>
           <!-- https://mvnrepository.com/artifact/org.apache.shardingsphere/shardingsphere-jdbc-core-spring-namespace -->
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core-spring-namespace</artifactId>
               <version>5.2.1</version>
           </dependency>
         
       </dependencies>
   ```
   
   ## 1.2. spring config 
   ```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"
          xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding"
          xsi:schemaLocation="http://www.springframework.org/schema/beans
                              http://www.springframework.org/schema/beans/spring-beans.xsd
                              http://www.springframework.org/schema/tx
                              http://www.springframework.org/schema/tx/spring-tx.xsd
                              http://www.springframework.org/schema/context
                              http://www.springframework.org/schema/context/spring-context.xsd
                              http://shardingsphere.apache.org/schema/shardingsphere/datasource
                              http://shardingsphere.apache.org/schema/shardingsphere/datasource/datasource.xsd
                              http://shardingsphere.apache.org/schema/shardingsphere/sharding
                              http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd
                              ">
   
   
       <context:component-scan base-package="com.baidu.cn.mapper" />
   
       <bean id="demo_ds_0" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
           <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
           <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/aaaa?serverTimezone=UTC&amp;useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
           <property name="username" value="root"/>
           <property name="password" value="rootroot"/>
       </bean>
   
       <bean id="demo_ds_1" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
           <property name="driverClassName" value="com.mysql.cj.jdbc.Driver"/>
           <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/bbbb?serverTimezone=UTC&amp;useSSL=false&amp;useUnicode=true&amp;characterEncoding=UTF-8"/>
           <property name="username" value="root"/>
           <property name="password" value="rootroot"/>
       </bean>
   
       <sharding:standard-strategy id="databaseStrategy" sharding-column="id" algorithm-ref="inlineStrategyShardingAlgorithm" />
   
       <sharding:sharding-algorithm id="inlineStrategyShardingAlgorithm" type="INLINE">
           <props>
               <prop key="algorithm-expression">demo_ds_${id % 2}</prop>
           </props>
       </sharding:sharding-algorithm>
   
       <sharding:key-generate-algorithm id="snowflakeAlgorithm" type="SNOWFLAKE">
       </sharding:key-generate-algorithm>
   
       <sharding:key-generate-strategy id="empKeyGenerator" column="id" algorithm-ref="snowflakeAlgorithm" />
   
   
       <sharding:rule id="shardingRule">
           <sharding:table-rules>
               <sharding:table-rule logic-table="t_emp" database-strategy-ref="databaseStrategy" key-generate-strategy-ref="empKeyGenerator" />
           </sharding:table-rules>
       </sharding:rule>
   
       <shardingsphere:data-source id="shardingDataSource" database-name="sharding-databases" data-source-names="demo_ds_0, demo_ds_1" rule-refs="shardingRule" />
   
       <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
           <property name="dataSource" ref="shardingDataSource" />
       </bean>
       <tx:annotation-driven />
   
       <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
           <property name="dataSource" ref="shardingDataSource"/>
       </bean>
   
       <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
           <property name="basePackage" value="com.baidu.cn.mapper"/>
           <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
       </bean>
   
   ```
   
   ## 1.3 springmvc config 
   ```xml
   <?xml version="1.0" encoding="UTF-8"?>
   <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:mvc="http://www.springframework.org/schema/mvc"
          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/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
   
   
       <context:component-scan base-package="com.baidu.cn.controller"/>
   
       <mvc:annotation-driven/>
   </beans>
   ```
   
   ## 1.4 web.xml
   ```xml
   <web-app>
    <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>classpath:spring.xml</param-value>
    </context-param>
     <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
     
     <servlet>
       <servlet-name>dispatcher</servlet-name>
       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
       <init-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>classpath:mvc.xml</param-value>
       </init-param>
     </servlet>
     
     <servlet-mapping>
       <servlet-name>dispatcher</servlet-name>
       <url-pattern>/</url-pattern>
     </servlet-mapping>
   </web-app>
   ```
   ## 1.5. tomcat start error 
   ```java 
   	org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingDataSource': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; nested exception is java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
   		at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:304)
   		at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:285)
   		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341)
   		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187)
   		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
   		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
   		at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
   		at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
   		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
   		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
   		at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
   		at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
   		at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
   		at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:400)
   		at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291)
   		at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103)
   		at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4678)
   		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5139)
   		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
   		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
   		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
   		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
   		at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1727)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:288)
   		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
   		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
   		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:456)
   		at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:405)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   		at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:288)
   		at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809)
   		at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
   		at java.management/com.sun.jmx.remote.security.MBeanServerAccessController.invoke(MBeanServerAccessController.java:468)
   		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466)
   		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307)
   		at java.base/java.security.AccessController.doPrivileged(Native Method)
   		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1406)
   		at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   		at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
   		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
   		at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
   		at java.base/java.security.AccessController.doPrivileged(Native Method)
   		at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
   		at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
   		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
   		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
   		at java.base/java.security.AccessController.doPrivileged(Native Method)
   		at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
   		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   		at java.base/java.lang.Thread.run(Thread.java:834)
   	Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; nested exception is java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
   		at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184)
   		at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:117)
   		at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:300)
   		... 61 more
   	Caused by: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
   		at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:114)
   		at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:321)
   		at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:110)
   		at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
   		at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
   		at org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository.init(JDBCRepository.java:67)
   		at org.apache.shardingsphere.infra.util.spi.type.required.RequiredSPIRegistry.getRegisteredService(RequiredSPIRegistry.java:45)
   		at org.apache.shardingsphere.mode.repository.standalone.StandalonePersistRepositoryFactory.getInstance(StandalonePersistRepositoryFactory.java:44)
   		at org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:44)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:76)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:64)
   		at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   		at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   		at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
   		at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:172)
   		... 63 more
   	Caused by: java.sql.SQLException: No suitable driver
   		at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:298)
   		at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
   		... 78 more
   ```
   
   ## 2. My Question 
   ```
   I write it  the same to Official example . Why report an error?  how to solve
   ```


-- 
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1489776561

   In standalone mode, the metadata is stored in the H2 memory by default, so we need to use the H2 driver to connect.
   I think later versions will fix this.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] liruhui commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "liruhui (via GitHub)" <gi...@apache.org>.
liruhui commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1490653972

   ```
   Research until 2:00 AM , I found  add mysql-connector-java.jar in tomcat lib directory    Successful execution   why
   ```
   ![image](https://user-images.githubusercontent.com/24687986/228913992-8262e528-f873-453a-b0ec-5019dddcd77e.png)
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] liruhui commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "liruhui (via GitHub)" <gi...@apache.org>.
liruhui commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1490609792

   > In the Java API scenario, `DriverManager` can scan the required drivers, but the Spring namespace needs to find the corresponding `Bean`, the search way is different.
   
   ```
   Thank you !!! 
   
   shardingsphere5.2.1 spring-namespace error Has been solved.   just only add  <bean id="h2Driver" class="org.h2.Driver">
   
   but  
   
   shardingSphere Upgrade the version to 5.3.1.   use yaml+Driver  instead of  spring-namespace  
   The same code , I user yaml+Driver Encountered the same problem
    
   I really want to cry   because every example i write has error 
   
   ```
   ## 1. dependency(5.3.1)
   ```xml
      <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core</artifactId>
               <version>5.3.1</version>
           </dependency>
   ```
   
   ## 2. config  driver 
   ![image](https://user-images.githubusercontent.com/24687986/228904918-021cf3c8-3ca1-4eb5-8543-671b204eb382.png)
   
   ## 3. error info 
   ```java
   ### Cause: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:h2:mem:config;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false;MODE=MYSQL
   	java.sql.SQLException: No suitable driver
   		at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:298)
   		at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
   		at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:331)
   		at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:114)
   		at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
   		at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
   		at org.apache.shardingsphere.mode.repository.standalone.jdbc.JDBCRepository.init(JDBCRepository.java:68)
   		at org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.findRegisteredService(TypedSPIRegistry.java:66)
   		at org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPIRegistry.getRegisteredService(TypedSPIRegistry.java:113)
   		at org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:49)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:81)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:66)
   		at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93)
   		at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:133)
   		at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:75)
   		at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:51)
   		at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
   		at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:45)
   		at org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:51)
   		at org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:144)
   		at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
   		at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169)
   		at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158)
   		at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116)
   		at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
   		at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80)
   		at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)
   		at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:337)
   		at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
   		at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
   		at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   		at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   		at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
   		at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   		at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
   		at com.sun.proxy.$Proxy12.insert(Unknown Source)
   		at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
   		at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
   		at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
   		at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
   		at com.sun.proxy.$Proxy24.save(Unknown Source)
   ```
   
   ## 4. config h2
   ![image](https://user-images.githubusercontent.com/24687986/228905555-cb923294-3a96-47e3-98e5-f68935ac02a2.png)
   
   ## 5. Still reporting an error
   ```java
   ### Cause: java.lang.RuntimeException: Failed to get driver instance for jdbcUrl=jdbc:mysql://192.168.191.128:3306/db_book?serverTimezone=UTC
   	java.sql.SQLException: No suitable driver
   		at java.sql/java.sql.DriverManager.getDriver(DriverManager.java:298)
   		at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:106)
   		at com.zaxxer.hikari.pool.PoolBase.initializeDataSource(PoolBase.java:331)
   		at com.zaxxer.hikari.pool.PoolBase.<init>(PoolBase.java:114)
   		at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:108)
   		at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112)
   		at org.apache.shardingsphere.infra.datasource.state.DataSourceStateManager.checkState(DataSourceStateManager.java:84)
   		at org.apache.shardingsphere.infra.datasource.state.DataSourceStateManager.initState(DataSourceStateManager.java:79)
   		at org.apache.shardingsphere.infra.datasource.state.DataSourceStateManager.lambda$initStates$0(DataSourceStateManager.java:70)
   		at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:684)
   		at org.apache.shardingsphere.infra.datasource.state.DataSourceStateManager.initStates(DataSourceStateManager.java:70)
   		at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.lambda$checkDataSourceStates$4(MetaDataContextsFactory.java:113)
   		at java.base/java.util.HashMap.forEach(HashMap.java:1336)
   		at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.checkDataSourceStates(MetaDataContextsFactory.java:111)
   		at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:87)
   		at org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:68)
   		at org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:54)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:81)
   		at org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:66)
   		at org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:93)
   		at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:133)
   		at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:75)
   		at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:51)
   		at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
   		at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:45)
   		at org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:51)
   		at org.springframework.jdbc.datasource.SimpleDriverDataSource.getConnectionFromDriver(SimpleDriverDataSource.java:144)
   		at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205)
   		at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169)
   		at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158)
   		at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116)
   		at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
   		at org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80)
   		at org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)
   		at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:337)
   		at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
   		at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:49)
   		at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
   		at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
   		at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:197)
   		at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:184)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   		at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
   		at com.sun.proxy.$Proxy12.insert(Unknown Source)
   		at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
   		at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
   		at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
   		at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
   		at com.sun.proxy.$Proxy24.save(Unknown Source)
   ```
   
   
   
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] liruhui commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "liruhui (via GitHub)" <gi...@apache.org>.
liruhui commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1489838761

   > In standalone mode, the metadata is stored in the H2 memory by default, so we need to use the H2 driver to connect. I think later versions will fix this.
   
   I see thank you  
   
   the  last question  
   H2 need driver   but  write code  by JavaAPI   why  not need write h2 driver (example below)
   
   ![image](https://user-images.githubusercontent.com/24687986/228764349-827ea9de-2b37-4359-b444-bc430f2dd637.png)
   
   
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1488852769

   Hi @liruhui , duplacated with #23768, please refer it.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] liruhui commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "liruhui (via GitHub)" <gi...@apache.org>.
liruhui commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1489771801

   > Hi @liruhui , duplicated with #23768, please refer it.
   
   Thank you  The problem has been sovled . but  I can not understand  if  i configure standlone mode  use JDBC  not use H2。still need to configure H2.  (example below)
   ![image](https://user-images.githubusercontent.com/24687986/228750039-e5571583-e75b-4a99-8dd6-483102a6024e.png)
   
   
   
   
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang closed issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #24894: ssm+spring-namespace  has a RuntimeException
URL: https://github.com/apache/shardingsphere/issues/24894


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #24894: ssm+spring-namespace has a RuntimeException

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #24894:
URL: https://github.com/apache/shardingsphere/issues/24894#issuecomment-1489894274

   In the Java API scenario, `DriverManager` can scan the required drivers, but the Spring namespace needs to find the corresponding `Bean`, the search way is different.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org