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 2021/11/11 09:31:50 UTC

[GitHub] [shardingsphere] SFlora opened a new issue #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

SFlora opened a new issue #13554:
URL: https://github.com/apache/shardingsphere/issues/13554


   ### Which version of ShardingSphere did you use?
   5.0.0
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected & Actual behavior
   ![image](https://user-images.githubusercontent.com/11220892/141272468-38932f7d-dfcd-414c-abea-47a81939b8e9.png)
   ### Reason analyze
   I did not configure the properties of "spring.shardingsphere.rules"
   Because I only need to use the distributed transaction of ShardingSphere
   ![image](https://user-images.githubusercontent.com/11220892/141265517-9e2b2874-8ece-4132-9f0f-f4e0ce77406c.png)
   In version 5.0.0-beta, the above configuration can successfully start the application
   But in version 5.0.0, the return result of the method getMatchOutcome in the class LocalRulesCondition is noMatch
   An exception will be thrown during startup
   """
   Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.apache.shardingsphere.infra.config.mode.ModeConfiguration' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
   """
   If I configure the parameters
   spring.shardingsphere.mode.type= Memory
   The seata service will throw an exception again
   """
   Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.shardingsphere.infra.metadata.resource.CachedDatabaseMetaData.getUrl()" because "this.cachedDatabaseMetaData" is null
   """
   When I configure the "spring.shardingsphere.rules" parameters to successfully start the application


-- 
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] ASCE1885 commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > > i have same problem
   > 
   > Can you provider your configuration?
   
   I am using Spring Boot 2.1.1.RELEASE, `pom.xml`:
   
   ```xml
   <dependency>
     <groupId>org.apache.shardingsphere</groupId>
     <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
     <version>5.0.0</version>
   </dependency>
   ```
   
   `application.properties`:
   
   ```properties
   spring.shardingsphere.datasource.names = master1
   
   spring.shardingsphere.datasource.master1.jdbc-url = jdbc:mysql://30.99.88.33:3306/xxx
   spring.shardingsphere.datasource.master1.type =  com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.master1.driver-class-name = com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.master1.username = asce
   spring.shardingsphere.datasource.master1.password = xxx
   spring.shardingsphere.datasource.master1.xxx =  # 数据库连接池的其它属性
   
   spring.shardingsphere.rules.encrypt.tables.t_user_a.columns.email.cipher-column=email
   spring.shardingsphere.rules.encrypt.tables.t_user_a.columns.email.encryptor-name=encryptor_aes
   
   spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.type = AES
   spring.shardingsphere.rules.encrypt.encryptors.name-encryptor.props.aes-key-value = xxxx
   
   spring.shardingsphere.rules.encrypt.queryWithCipherColumn = true
   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] ASCE1885 edited a comment on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > > i have same problem
   > 
   > Can you provider your configuration?
   
   I am using Spring Boot 2.1.1.RELEASE, `pom.xml`:
   
   ```xml
   <dependency>
     <groupId>org.apache.shardingsphere</groupId>
     <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
     <version>5.0.0</version>
   </dependency>
   ```
   
   `application.properties`:
   
   ```properties
   spring.shardingsphere.datasource.names = master1
   
   spring.shardingsphere.datasource.master1.jdbc-url = jdbc:mysql://30.99.88.33:3306/xxx
   spring.shardingsphere.datasource.master1.type =  com.zaxxer.hikari.HikariDataSource
   spring.shardingsphere.datasource.master1.driver-class-name = com.mysql.jdbc.Driver
   spring.shardingsphere.datasource.master1.username = asce
   spring.shardingsphere.datasource.master1.password = xxx
   spring.shardingsphere.datasource.master1.xxx =  # 数据库连接池的其它属性
   
   spring.shardingsphere.rules.encrypt.tables.t_user_a.columns.email.cipher-column=email
   spring.shardingsphere.rules.encrypt.tables.t_user_a.columns.email.encryptor-name=encryptor_aes
   
   spring.shardingsphere.rules.encrypt.encryptors.encryptor_aes.type = AES
   spring.shardingsphere.rules.encrypt.encryptors.encryptor_aes.props.aes-key-value = xxxx
   
   spring.shardingsphere.rules.encrypt.queryWithCipherColumn = true
   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] zjcnb commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > add `spring.shardingshpere.mode.type=Memory` like @zjcnb  say
   
   You needn't  configuration mode Memory, And `now the project can launch successfully, but when I run a select SQL through MyBatis, there is a NoSuchElementException:null.` it 's a new problem, Can you create new issue?


-- 
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 #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > spring.shardingshpere.mode.type=Memory
   
   There are optional. So you can not set 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] SFlora commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > @SFlora Hi, sharding-jdbc are must be config with rule. If you needn't rule, you can try sharding-proxy.
   
   But I can run successfully in version 5.0.0-beta without config "rules"
   Is "must be config with rule" a new requirement of the new version?


-- 
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] ASCE1885 commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > @ASCE1885 Hi bro, Can you change encryptor_aes to encryptor-aes. Then try it again.
   
   after changing encryptor_aes to encryptor-aes the result is still the same. But I made some changes:
   
   ```
   1) update spring boot to 2.3.4.RELEASE
   2) add `spring.shardingshpere.mode.type=Memory` like @zjcnb  say
   ```
   
   now the project can launch successfully, but when I run a select SQL through MyBatis, there is a NoSuchElementException:null.
   
   ![image](https://user-images.githubusercontent.com/4355850/141428997-3a31ae33-140c-40c9-aafb-53a93e514486.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] ASCE1885 commented on issue #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   the same version 5.0.0, I have config with rule, but still got `No qualifying bean of type 'org.apache.shardingsphere.infra.config.mode.ModeConfiguration' available`


-- 
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 #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   @ASCE1885 Hi bro, Can you change encryptor_aes to encryptor-aes. Then try it again.


-- 
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 #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > > @SFlora Hi, sharding-jdbc are must be config with rule. If you needn't rule, you can try sharding-proxy.
   > 
   > But I can run successfully in version 5.0.0-beta without config "rules" Is "must be config with rule" a new requirement of the new version?
   
   yes, i think if you use sharding-jdbc, you hava sharding demand. Do you have other ideas?


-- 
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 #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   @SFlora Hi,  sharding-jdbc are must be config with rule. If you needn't rule, you can try sharding-proxy.


-- 
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] makexiao113 commented on issue #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   i have same problem


-- 
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 #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   > the same version 5.0.0, I have config with rule, but still got `No qualifying bean of type 'org.apache.shardingsphere.infra.config.mode.ModeConfiguration' available`
   
   Can you provider your configuration?


-- 
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] makexiao113 commented on issue #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   > > i have same problem
   > 
   > Can you provider your configuration?
   
   this is my issue:https://github.com/apache/shardingsphere/issues/13526


-- 
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 #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   > i have same problem
   
   Can you provider your configuration?
   
   


-- 
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] makexiao113 commented on issue #13554: Cannot register ShardingSphereDataSource without configuring spring.shardingsphere.rules

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


   > > i have same problem
   > 
   > Can you provider your configuration?
   
   spring:
     application:
       name: membership
     shardingsphere:
       datasource:
         names: master
         master:
           type: com.alibaba.druid.pool.DruidDataSource
           driver-class-name: com.mysql.cj.jdbc.Driver
           url: jdbc:mysql://localhost:3306/membership
           username: membership
           password: membership
       mode:
         type: Memory
       schema:
         name: master


-- 
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] makexiao113 commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   > the same version 5.0.0, I have config with rule, but still got `No qualifying bean of type 'org.apache.shardingsphere.infra.config.mode.ModeConfiguration' available`
   
   you can add this configuration:
   spring.shardingshpere.mode.type=Memory
   
   https://shardingsphere.apache.org/document/5.0.0/cn/user-manual/shardingsphere-jdbc/configuration/yaml/mode/


-- 
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] SFlora closed issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

Posted by GitBox <gi...@apache.org>.
SFlora closed issue #13554:
URL: https://github.com/apache/shardingsphere/issues/13554


   


-- 
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] legendyman commented on issue #13554: If spring.shardingsphere.rules is not configured, ShardingSphereDataSource cannot be injected

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


   this is my configuration,
   ![image](https://user-images.githubusercontent.com/95357724/144244835-53c18649-8db3-4eda-bd00-298eb5915361.png)
   in this configuration, i have excluded druid data source configuration in springboot runner class.
   the issue is :
   ![image](https://user-images.githubusercontent.com/95357724/144245309-95c95074-ffa8-4b4b-9fb3-8498af79e0d3.png)
   thank you


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