KeepWalking8 opened a new issue #9463:
URL: https://github.com/apache/shardingsphere/issues/9463


   Spring Boot ::                             v2.4.2
   Spring:                                       v5.3.3
   Spring Data JPA
   Hibernate ORM core version:   5.4.27.Final
   Database:                                  postgresql-13.1
   shardingsphere:  
   <dependency>
            <groupId>org.apache.shardingsphere</groupId>
             
<artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
             <version>5.0.0-alpha</version>
   </dependency>
   
   application.yml:
   spring:
     shardingsphere:
       props:
         sql.show: true
       datasource:
         common:
           driver-class-name: org.postgresql.Driver
           type: com.alibaba.druid.pool.DruidDataSource
         names: master0
         master0:
           # postgres database
           url: jdbc:postgresql://localhost:5432/kpi
           username: potgres
           password: postgres
           initialization-mode: always
       rules:
         sharding:
           key-generators:
             snowflake:
               type: SNOWFLAKE
               props:
                 worker-id: 1
           sharding-algorithms:
             sharding-by-month: 
               type: INTERVAL 
               props: 
                 datetime-pattern: "yyyy-MM-dd HH:mm:ss"
                 datetime-lower: "2021-02-01 00:00:00"
                 datetime-upper: "2021-12-31 23:59:59"
                 sharding-suffix-pattern: "yyyyMM"
                 datetime-interval-amount: 1
                 datetime-interval-unit: "MONTHS"
           tables:
             kpi_data: 
               actual-data-nodes: master0.kpi_data_$->{2021..2021}0$->{1..9}, 
master0.kpi_data_$->{2021..2021}$->{10..12}
               table-strategy:
                 standard:
                   sharding-column: begin_time
                   sharding-algorithm-name: sharding-by-month
               key-generate-strategy:
                 column: id
                 key-generator-name: snowflake
       enabled: true
   
     jpa:
       hibernate:
         ddl-auto: update #none
       show-sql: true
       properties:
         hibernate:
           temp:
           use_jdbc_metadata_defaults: false
   
   
   when application starts, exception occurs:
   org.springframework.beans.factory.BeanCreationException: Error creating bean 
with name 'entityManagerFactory' defined in class path resource 
[org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]:
 Invocation of init method failed; nested exception is 
javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to 
build Hibernate SessionFactory; nested exception is 
org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not 
route tables for `[sequences]`, please make sure the tables are in same schema.
   ......
   Caused by: javax.persistence.PersistenceException: [PersistenceUnit: 
default] Unable to build Hibernate SessionFactory; nested exception is 
org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not 
route tables for `[sequences]`, please make sure the tables are in same schema.
        at 
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:421)
 ~[spring-orm-5.3.3.jar:5.3.3]
        at 
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:396)
 ~[spring-orm-5.3.3.jar:5.3.3]
        at 
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
 ~[spring-orm-5.3.3.jar:5.3.3]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1847)
 ~[spring-beans-5.3.3.jar:5.3.3]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1784)
 ~[spring-beans-5.3.3.jar:5.3.3]
        ... 22 common frames omitted
   Caused by: 
org.apache.shardingsphere.infra.exception.ShardingSphereException: Can not 
route tables for `[sequences]`, please make sure the tables are in same schema.
        at 
org.apache.shardingsphere.sharding.route.engine.type.unconfigured.ShardingUnconfiguredTablesRoutingEngine.route(ShardingUnconfiguredTablesRoutingEngine.java:55)
 ~[shardingsphere-sharding-route-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:70)
 ~[shardingsphere-sharding-route-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:55)
 ~[shardingsphere-sharding-route-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:59)
 ~[shardingsphere-infra-route-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:57)
 ~[shardingsphere-infra-route-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:52)
 ~[shardingsphere-infra-context-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.createExecutionContext(ShardingSphereStatement.java:289)
 ~[shardingsphere-jdbc-core-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSphereStatement.executeQuery(ShardingSphereStatement.java:126)
 ~[shardingsphere-jdbc-core-5.0.0-alpha.jar:5.0.0-alpha]
        at 
org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:42)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:65)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:59)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:155)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:96)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:184)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:316) 
~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:469)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259)
 ~[hibernate-core-5.4.27.Final.jar:5.4.27.Final]
        at 
org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
 ~[spring-orm-5.3.3.jar:5.3.3]
        at 
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
 ~[spring-orm-5.3.3.jar:5.3.3]
        at 
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:409)
 ~[spring-orm-5.3.3.jar:5.3.3]
        ... 26 common frames omitted
   
   
-----------------------------------------------------------------------------------------------------------------------------------
   'select * from information_schema.sequences' will be automatically exceuted 
before creating table, then exception occurs
   
   


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

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


Reply via email to