<p dir="auto">Integrating sharding-transaction-base-saga to configure saga. properties file with saga. persistence. enabled = true, and then configuring saga. persistence. ds. content, resulting in SpringBootConfiguration. dataSource () method creating dataSource error subsequently leading to</p>
<p dir="auto">Java.util.Service Configuration Error: org.apache.shardingsphere.transaction.spi.ShardingTransaction Manager: Provider.shardingsphere.transaction.saga.SagaShardingTransaction Manager can not be instantiated</p>
<h2 dir="auto">Bug Report</h2>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">compile group: 'org.apache.shardingsphere', name: 'sharding-jdbc-spring-boot-starter', version: '4.0.0-RC1'</p>
<h3 dir="auto">Which project did you use? Sharding-JDBC or Sharding-Proxy?</h3>
<p dir="auto">sharding-jdbc-spring-boot-starter</p>
<p dir="auto">springboot: 2.1.0<br>
spring-boot-starter-data-jpa:2.1.0</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Start the application normally</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">Caused by: java.lang.NullPointerException</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">myconfig</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="spring:
    data:
        redis:
            repositories:
                enabled: false
        jpa:
           database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
           hibernate:
                ddl-auto: update
    shardingsphere:
        datasource:
            names: master,slave
            master:
                driver-class-name: com.mysql.cj.jdbc.Driver
                password: '****'
                url: jdbc:mysql://192.168.20.6:3306/***?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
                username: root
                type: com.alibaba.druid.pool.DruidDataSource

            slave:
                driver-class-name: com.mysql.cj.jdbc.Driver
                password: '*****'
                url: jdbc:mysql://192.168.20.6:3307/*****?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
                username: root
                type: com.alibaba.druid.pool.DruidDataSource

        masterslave:
            load-balance-algorithm-type: round_robin
            name: ms
            master-data-source-name: master
            slave-data-source-names: slave

        props:
            sql:
                show: true"><pre class="notranslate"><code class="notranslate">spring:
    data:
        redis:
            repositories:
                enabled: false
        jpa:
           database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
           hibernate:
                ddl-auto: update
    shardingsphere:
        datasource:
            names: master,slave
            master:
                driver-class-name: com.mysql.cj.jdbc.Driver
                password: '****'
                url: jdbc:mysql://192.168.20.6:3306/***?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
                username: root
                type: com.alibaba.druid.pool.DruidDataSource

            slave:
                driver-class-name: com.mysql.cj.jdbc.Driver
                password: '*****'
                url: jdbc:mysql://192.168.20.6:3307/*****?createDatabaseIfNotExist=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;useLegacyDatetimeCode=false&amp;serverTimezone=UTC
                username: root
                type: com.alibaba.druid.pool.DruidDataSource

        masterslave:
            load-balance-algorithm-type: round_robin
            name: ms
            master-data-source-name: master
            slave-data-source-names: slave

        props:
            sql:
                show: true
</code></pre></div>
<p dir="auto">the traceback info:</p>
<p dir="auto">Caused by: java.lang.NullPointerException<br>
at org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.metadata.ResultSetReturnedDatabaseMetaData.getActualTableNamePattern(ResultSetReturnedDatabaseMetaData.java:265) ~[sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1]<br>
at org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.metadata.ResultSetReturnedDatabaseMetaData.getTables(ResultSetReturnedDatabaseMetaData.java:94) ~[sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1]<br>
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getTables(InformationExtractorJdbcDatabaseMetaDataImpl.java:329) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:120) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:65) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:310) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]<br>
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1821) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1758) ~[spring-beans-5.1.5.RELEASE.jar:5.1.5.RELEASE]</p>
<h3 dir="auto">analyze</h3>
<p dir="auto">for Sharding-JDBC,i only want to use master-slave pattern,<br>
when i set the ddl-auto = create or create_drop, my application start right, when the<br>
value is update or validate, it will be cause NullPointerException, i followed the source code,<br>
when init MasterSlaveDataSource class, in createCachedDatabaseMetaData()  function,<br>
it return new CachedDatabaseMetaData(connection.getMetaData(), dataSourceMap, null);<br>
the third args is null, it named ShardingRule.</p>
<p dir="auto">the stack info :org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getTables()<br>
will invoke ResultSetReturnedDatabaseMetaData.java:94.<br>
because ShardingRule is null, so raise NullPointerException..</p>