You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/02/25 06:42:10 UTC

[GitHub] [shardingsphere] 13612687938 opened a new issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

13612687938 opened a new issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629


   ## Bug Report
   
   Current situation:
   SpringBoot + Mybatis-Plus + MySQL8.0 + ShardingSphere-JDBC  ===> SUCCESS
   SpringBoot + SpringDataJPA + MySQL8.0 + ShardingSphere-JDBC  ===> FAIL (read and write both on write-ds)
   
   expect:
   write on write-ds, read on read-ds.
   
         <dependencies>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-data-jpa</artifactId>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-web</artifactId>
           </dependency>
   
           <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
               <scope>runtime</scope>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-configuration-processor</artifactId>
               <optional>true</optional>
           </dependency>
           <dependency>
               <groupId>org.projectlombok</groupId>
               <artifactId>lombok</artifactId>
               <optional>true</optional>
           </dependency>
           <dependency>
               <groupId>org.springframework.boot</groupId>
               <artifactId>spring-boot-starter-test</artifactId>
               <scope>test</scope>
           </dependency>
   
           <!-- ShardingSphere -->
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
               <version>5.1.0</version>
           </dependency>
       </dependencies>
   
   application.properties just copy url "https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties"
   
   `spring.shardingsphere.datasource.names=write-ds,read-ds-0,read-ds-1
   
   spring.shardingsphere.datasource.write-ds.jdbc-url=jdbc:mysql://localhost:3306/shardingsphere-main?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
   spring.shardingsphere.datasource.write-ds.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.write-ds.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.write-ds.username=root
   spring.shardingsphere.datasource.write-ds.password=root
   
   spring.shardingsphere.datasource.read-ds-0.jdbc-url=jdbc:mysql://localhost:3306/shardingsphere-slave1?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
   spring.shardingsphere.datasource.read-ds-0.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.read-ds-0.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.read-ds-0.username=root
   spring.shardingsphere.datasource.read-ds-0.password=root
   
   spring.shardingsphere.datasource.read-ds-1.jdbc-url=jdbc:mysql://localhost:3306/shardingsphere-slave2?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
   spring.shardingsphere.datasource.read-ds-1.type=com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.read-ds-1.driver-class-name=com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.read-ds-1.username=root
   spring.shardingsphere.datasource.read-ds-1.password=root
   
   spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.type=Static
   spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.props.write-data-source-name=write-ds
   spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.props.read-data-source-names=read-ds-0,read-ds-1
   spring.shardingsphere.rules.readwrite-splitting.data-sources.readwrite_ds.load-balancer-name=round_robin
   spring.shardingsphere.rules.readwrite-splitting.load-balancers.round_robin.type=ROUND_ROBIN
   
   spring.shardingsphere.props.sql-show=true`


-- 
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] nekolr edited a comment on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
nekolr edited a comment on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1064699460


   i got the same problem when i using `org.springframework.data.repository.CrudRepository#findById`. 
   
   i traced the call stack and found the reason:
   
   > refer: hibernate-core\5.6.5.Final\hibernate-core-5.6.5.Final.jar!\org\hibernate\resource\jdbc\internal\AbstractLogicalConnectionImplementor.class
   ```
   public void begin() {
       try {
           if (!this.doConnectionsFromProviderHaveAutoCommitDisabled()) {
               log.trace("Preparing to begin transaction via JDBC Connection.setAutoCommit(false)");
               // here
               this.getConnectionForTransactionManagement().setAutoCommit(false);
               log.trace("Transaction begun via JDBC Connection.setAutoCommit(false)");
           }
   
           this.status = TransactionStatus.ACTIVE;
       } catch (SQLException var2) {
           throw new TransactionException("JDBC begin transaction failed: ", var2);
       }
   }
   ```
   
   call stack:
   ```
   setAutoCommit:129, ShardingSphereConnection (org.apache.shardingsphere.driver.jdbc.core.connection)
   begin:72, AbstractLogicalConnectionImplementor (org.hibernate.resource.jdbc.internal)
   begin:285, LogicalConnectionManagedImpl (org.hibernate.resource.jdbc.internal)
   begin:246, JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl (org.hibernate.resource.transaction.backend.jdbc.internal)
   begin:83, TransactionImpl (org.hibernate.engine.transaction.internal)
   beginTransaction:164, HibernateJpaDialect (org.springframework.orm.jpa.vendor)
   doBegin:421, JpaTransactionManager (org.springframework.orm.jpa)
   startTransaction:400, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   getTransaction:373, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   createTransactionIfNecessary:595, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invokeWithinTransaction:382, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invoke:119, TransactionInterceptor (org.springframework.transaction.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:137, PersistenceExceptionTranslationInterceptor (org.springframework.dao.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:174, CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor (org.springframework.data.jpa.repository.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:97, ExposeInvocationInterceptor (org.springframework.aop.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:215, JdkDynamicAopProxy (org.springframework.aop.framework)
   findById:-1, $Proxy237 (com.sun.proxy)
   getUser:18, UserService (com.example.mysqlreadwrite)
   getUser:20, UserController (com.example.mysqlreadwrite)
   invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
   invoke:62, NativeMethodAccessorImpl (sun.reflect)
   invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
   invoke:498, Method (java.lang.reflect)
   doInvoke:205, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeForRequest:150, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeAndHandle:117, ServletInvocableHandlerMethod (org.springframework.web.servlet.mvc.method.annotation)
   invokeHandlerMethod:895, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handleInternal:808, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handle:87, AbstractHandlerMethodAdapter (org.springframework.web.servlet.mvc.method)
   doDispatch:1067, DispatcherServlet (org.springframework.web.servlet)
   doService:963, DispatcherServlet (org.springframework.web.servlet)
   processRequest:1006, FrameworkServlet (org.springframework.web.servlet)
   doGet:898, FrameworkServlet (org.springframework.web.servlet)
   service:655, HttpServlet (javax.servlet.http)
   service:883, FrameworkServlet (org.springframework.web.servlet)
   service:764, HttpServlet (javax.servlet.http)
   internalDoFilter:227, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:53, WsFilter (org.apache.tomcat.websocket.server)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:100, RequestContextFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:93, FormContentFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:201, CharacterEncodingFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   invoke:197, StandardWrapperValve (org.apache.catalina.core)
   invoke:97, StandardContextValve (org.apache.catalina.core)
   invoke:540, AuthenticatorBase (org.apache.catalina.authenticator)
   invoke:135, StandardHostValve (org.apache.catalina.core)
   invoke:92, ErrorReportValve (org.apache.catalina.valves)
   invoke:78, StandardEngineValve (org.apache.catalina.core)
   service:359, CoyoteAdapter (org.apache.catalina.connector)
   service:399, Http11Processor (org.apache.coyote.http11)
   process:65, AbstractProcessorLight (org.apache.coyote)
   process:889, AbstractProtocol$ConnectionHandler (org.apache.coyote)
   doRun:1735, NioEndpoint$SocketProcessor (org.apache.tomcat.util.net)
   run:49, SocketProcessorBase (org.apache.tomcat.util.net)
   runWorker:1191, ThreadPoolExecutor (org.apache.tomcat.util.threads)
   run:659, ThreadPoolExecutor$Worker (org.apache.tomcat.util.threads)
   run:61, TaskThread$WrappingRunnable (org.apache.tomcat.util.threads)
   run:748, Thread (java.lang)
   ```


-- 
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] 13612687938 commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
13612687938 commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050625150


   Yes, I create 3 database(datasource),demo include sql which just create table.
   For simple testing, you can manually add XXX data to the slave-datasource1 and add YYY data to the slave-datasource2, and simply request the list interface to observe
   
   
   ------------------&nbsp;原始邮件&nbsp;------------------
   发件人:                                                                                                                        "apache/shardingsphere"                                                                                    ***@***.***&gt;;
   发送时间:&nbsp;2022年2月25日(星期五) 下午3:57
   ***@***.***&gt;;
   ***@***.******@***.***&gt;;
   主题:&nbsp;Re: [apache/shardingsphere] Springboot with JPA, readwrite-splitting always on write-ds (Issue #15629)
   
   
   
   
   
     
   https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties
     
   Can you provider a demo?
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   Triage notifications on the go with GitHub Mobile for iOS or Android. 
   You are receiving this because you were mentioned.Message ID: ***@***.***&gt;


-- 
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] 13612687938 commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
13612687938 commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050616116


    @zjcnb Different, I just query the data, no insert operation


-- 
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] 13612687938 commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
13612687938 commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050779223


   this is a demo, with sql for create table, without sql for create database.
   
   
   
   
   ------------------&nbsp;原始邮件&nbsp;------------------
   发件人:                                                                                                                        "apache/shardingsphere"                                                                                    ***@***.***&gt;;
   发送时间:&nbsp;2022年2月25日(星期五) 晚上7:02
   ***@***.***&gt;;
   ***@***.******@***.***&gt;;
   主题:&nbsp;Re: [apache/shardingsphere] Springboot with JPA, readwrite-splitting always on write-ds (Issue #15629)
   
   
   
   
   
     
   Yes, I create 3 database(datasource),demo include sql which just create table. For simple testing, you can manually add XXX data to the slave-datasource1 and add YYY data to the slave-datasource2, and simply request the list interface to observe
    …
    ------------------&nbsp;原始邮件&nbsp;------------------ 发件人: "apache/shardingsphere" @.&gt;; 发送时间:&nbsp;2022年2月25日(星期五) 下午3:57 @.&gt;; @.@.&gt;; 主题:&nbsp;Re: [apache/shardingsphere] Springboot with JPA, readwrite-splitting always on write-ds (Issue #15629) https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties Can you provider a demo? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***&gt;
     
   Provider demo project. Because i can't reproduce it.
    
   —
   Reply to this email directly, view it on GitHub, or unsubscribe.
   Triage notifications on the go with GitHub Mobile for iOS or Android. 
   You are receiving this because you were mentioned.Message ID: ***@***.***&gt;


-- 
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] zjcnb commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050754425


   > Yes, I create 3 database(datasource),demo include sql which just create table. For simple testing, you can manually add XXX data to the slave-datasource1 and add YYY data to the slave-datasource2, and simply request the list interface to observe
   > […](#)
   > ------------------&nbsp;原始邮件&nbsp;------------------ 发件人: "apache/shardingsphere" ***@***.***&gt;; 发送时间:&nbsp;2022年2月25日(星期五) 下午3:57 ***@***.***&gt;; ***@***.******@***.***&gt;; 主题:&nbsp;Re: [apache/shardingsphere] Springboot with JPA, readwrite-splitting always on write-ds (Issue #15629) https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties Can you provider a demo? — Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: ***@***.***&gt;
   
   Provider demo project. Because i can't reproduce 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] zjcnb commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050619122


   > https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties
   
   Can you provider a demo?


-- 
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] nekolr commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
nekolr commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1064699460


   Same problem, i traced the call stack and found the reason:
   
   > refer: hibernate-core\5.6.5.Final\hibernate-core-5.6.5.Final.jar!\org\hibernate\resource\jdbc\internal\AbstractLogicalConnectionImplementor.class
   ```
   public void begin() {
       try {
           if (!this.doConnectionsFromProviderHaveAutoCommitDisabled()) {
               log.trace("Preparing to begin transaction via JDBC Connection.setAutoCommit(false)");
               // here
               this.getConnectionForTransactionManagement().setAutoCommit(false);
               log.trace("Transaction begun via JDBC Connection.setAutoCommit(false)");
           }
   
           this.status = TransactionStatus.ACTIVE;
       } catch (SQLException var2) {
           throw new TransactionException("JDBC begin transaction failed: ", var2);
       }
   }
   ```
   
   ```
   setAutoCommit:129, ShardingSphereConnection (org.apache.shardingsphere.driver.jdbc.core.connection)
   begin:72, AbstractLogicalConnectionImplementor (org.hibernate.resource.jdbc.internal)
   begin:285, LogicalConnectionManagedImpl (org.hibernate.resource.jdbc.internal)
   begin:246, JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl (org.hibernate.resource.transaction.backend.jdbc.internal)
   begin:83, TransactionImpl (org.hibernate.engine.transaction.internal)
   beginTransaction:164, HibernateJpaDialect (org.springframework.orm.jpa.vendor)
   doBegin:421, JpaTransactionManager (org.springframework.orm.jpa)
   startTransaction:400, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   getTransaction:373, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   createTransactionIfNecessary:595, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invokeWithinTransaction:382, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invoke:119, TransactionInterceptor (org.springframework.transaction.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:137, PersistenceExceptionTranslationInterceptor (org.springframework.dao.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:174, CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor (org.springframework.data.jpa.repository.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:97, ExposeInvocationInterceptor (org.springframework.aop.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:215, JdkDynamicAopProxy (org.springframework.aop.framework)
   findById:-1, $Proxy237 (com.sun.proxy)
   getUser:18, UserService (com.example.mysqlreadwrite)
   getUser:20, UserController (com.example.mysqlreadwrite)
   invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
   invoke:62, NativeMethodAccessorImpl (sun.reflect)
   invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
   invoke:498, Method (java.lang.reflect)
   doInvoke:205, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeForRequest:150, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeAndHandle:117, ServletInvocableHandlerMethod (org.springframework.web.servlet.mvc.method.annotation)
   invokeHandlerMethod:895, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handleInternal:808, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handle:87, AbstractHandlerMethodAdapter (org.springframework.web.servlet.mvc.method)
   doDispatch:1067, DispatcherServlet (org.springframework.web.servlet)
   doService:963, DispatcherServlet (org.springframework.web.servlet)
   processRequest:1006, FrameworkServlet (org.springframework.web.servlet)
   doGet:898, FrameworkServlet (org.springframework.web.servlet)
   service:655, HttpServlet (javax.servlet.http)
   service:883, FrameworkServlet (org.springframework.web.servlet)
   service:764, HttpServlet (javax.servlet.http)
   internalDoFilter:227, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:53, WsFilter (org.apache.tomcat.websocket.server)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:100, RequestContextFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:93, FormContentFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:201, CharacterEncodingFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   invoke:197, StandardWrapperValve (org.apache.catalina.core)
   invoke:97, StandardContextValve (org.apache.catalina.core)
   invoke:540, AuthenticatorBase (org.apache.catalina.authenticator)
   invoke:135, StandardHostValve (org.apache.catalina.core)
   invoke:92, ErrorReportValve (org.apache.catalina.valves)
   invoke:78, StandardEngineValve (org.apache.catalina.core)
   service:359, CoyoteAdapter (org.apache.catalina.connector)
   service:399, Http11Processor (org.apache.coyote.http11)
   process:65, AbstractProcessorLight (org.apache.coyote)
   process:889, AbstractProtocol$ConnectionHandler (org.apache.coyote)
   doRun:1735, NioEndpoint$SocketProcessor (org.apache.tomcat.util.net)
   run:49, SocketProcessorBase (org.apache.tomcat.util.net)
   runWorker:1191, ThreadPoolExecutor (org.apache.tomcat.util.threads)
   run:659, ThreadPoolExecutor$Worker (org.apache.tomcat.util.threads)
   run:61, TaskThread$WrappingRunnable (org.apache.tomcat.util.threads)
   run:748, Thread (java.lang)
   ```


-- 
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] zjcnb commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050614368


   @13612687938 Hi, please refer to #14858 


-- 
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] zjcnb removed a comment on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
zjcnb removed a comment on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050619122


   > https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-jdbc-example/single-feature-example/readwrite-splitting-example/readwrite-splitting-spring-boot-jpa-example/src/main/resources/application-readwrite-splitting.properties
   
   Can you provider a demo?


-- 
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] zjcnb commented on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1050619401


   > @zjcnb Different, I just query the data, no insert operation
   
   Can you provider a demo?


-- 
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] nekolr edited a comment on issue #15629: Springboot with JPA, readwrite-splitting always on write-ds

Posted by GitBox <gi...@apache.org>.
nekolr edited a comment on issue #15629:
URL: https://github.com/apache/shardingsphere/issues/15629#issuecomment-1064699460


   Same problem, i traced the call stack and found the reason:
   
   > refer: hibernate-core\5.6.5.Final\hibernate-core-5.6.5.Final.jar!\org\hibernate\resource\jdbc\internal\AbstractLogicalConnectionImplementor.class
   ```
   public void begin() {
       try {
           if (!this.doConnectionsFromProviderHaveAutoCommitDisabled()) {
               log.trace("Preparing to begin transaction via JDBC Connection.setAutoCommit(false)");
               // here
               this.getConnectionForTransactionManagement().setAutoCommit(false);
               log.trace("Transaction begun via JDBC Connection.setAutoCommit(false)");
           }
   
           this.status = TransactionStatus.ACTIVE;
       } catch (SQLException var2) {
           throw new TransactionException("JDBC begin transaction failed: ", var2);
       }
   }
   ```
   
   call stack:
   ```
   setAutoCommit:129, ShardingSphereConnection (org.apache.shardingsphere.driver.jdbc.core.connection)
   begin:72, AbstractLogicalConnectionImplementor (org.hibernate.resource.jdbc.internal)
   begin:285, LogicalConnectionManagedImpl (org.hibernate.resource.jdbc.internal)
   begin:246, JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl (org.hibernate.resource.transaction.backend.jdbc.internal)
   begin:83, TransactionImpl (org.hibernate.engine.transaction.internal)
   beginTransaction:164, HibernateJpaDialect (org.springframework.orm.jpa.vendor)
   doBegin:421, JpaTransactionManager (org.springframework.orm.jpa)
   startTransaction:400, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   getTransaction:373, AbstractPlatformTransactionManager (org.springframework.transaction.support)
   createTransactionIfNecessary:595, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invokeWithinTransaction:382, TransactionAspectSupport (org.springframework.transaction.interceptor)
   invoke:119, TransactionInterceptor (org.springframework.transaction.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:137, PersistenceExceptionTranslationInterceptor (org.springframework.dao.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:174, CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor (org.springframework.data.jpa.repository.support)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:97, ExposeInvocationInterceptor (org.springframework.aop.interceptor)
   proceed:186, ReflectiveMethodInvocation (org.springframework.aop.framework)
   invoke:215, JdkDynamicAopProxy (org.springframework.aop.framework)
   findById:-1, $Proxy237 (com.sun.proxy)
   getUser:18, UserService (com.example.mysqlreadwrite)
   getUser:20, UserController (com.example.mysqlreadwrite)
   invoke0:-1, NativeMethodAccessorImpl (sun.reflect)
   invoke:62, NativeMethodAccessorImpl (sun.reflect)
   invoke:43, DelegatingMethodAccessorImpl (sun.reflect)
   invoke:498, Method (java.lang.reflect)
   doInvoke:205, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeForRequest:150, InvocableHandlerMethod (org.springframework.web.method.support)
   invokeAndHandle:117, ServletInvocableHandlerMethod (org.springframework.web.servlet.mvc.method.annotation)
   invokeHandlerMethod:895, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handleInternal:808, RequestMappingHandlerAdapter (org.springframework.web.servlet.mvc.method.annotation)
   handle:87, AbstractHandlerMethodAdapter (org.springframework.web.servlet.mvc.method)
   doDispatch:1067, DispatcherServlet (org.springframework.web.servlet)
   doService:963, DispatcherServlet (org.springframework.web.servlet)
   processRequest:1006, FrameworkServlet (org.springframework.web.servlet)
   doGet:898, FrameworkServlet (org.springframework.web.servlet)
   service:655, HttpServlet (javax.servlet.http)
   service:883, FrameworkServlet (org.springframework.web.servlet)
   service:764, HttpServlet (javax.servlet.http)
   internalDoFilter:227, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:53, WsFilter (org.apache.tomcat.websocket.server)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:100, RequestContextFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:93, FormContentFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   doFilterInternal:201, CharacterEncodingFilter (org.springframework.web.filter)
   doFilter:117, OncePerRequestFilter (org.springframework.web.filter)
   internalDoFilter:189, ApplicationFilterChain (org.apache.catalina.core)
   doFilter:162, ApplicationFilterChain (org.apache.catalina.core)
   invoke:197, StandardWrapperValve (org.apache.catalina.core)
   invoke:97, StandardContextValve (org.apache.catalina.core)
   invoke:540, AuthenticatorBase (org.apache.catalina.authenticator)
   invoke:135, StandardHostValve (org.apache.catalina.core)
   invoke:92, ErrorReportValve (org.apache.catalina.valves)
   invoke:78, StandardEngineValve (org.apache.catalina.core)
   service:359, CoyoteAdapter (org.apache.catalina.connector)
   service:399, Http11Processor (org.apache.coyote.http11)
   process:65, AbstractProcessorLight (org.apache.coyote)
   process:889, AbstractProtocol$ConnectionHandler (org.apache.coyote)
   doRun:1735, NioEndpoint$SocketProcessor (org.apache.tomcat.util.net)
   run:49, SocketProcessorBase (org.apache.tomcat.util.net)
   runWorker:1191, ThreadPoolExecutor (org.apache.tomcat.util.threads)
   run:659, ThreadPoolExecutor$Worker (org.apache.tomcat.util.threads)
   run:61, TaskThread$WrappingRunnable (org.apache.tomcat.util.threads)
   run:748, Thread (java.lang)
   ```


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