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 2020/02/04 01:26:23 UTC

[GitHub] [incubator-shardingsphere] cielswift edited a comment on issue #3993: Start error with yml

cielswift edited a comment on issue #3993: Start error with yml
URL: https://github.com/apache/incubator-shardingsphere/issues/3993#issuecomment-575495337
 
 
   @terrymanu 
   ```
   2020-01-17 14:34:43.348 ERROR 7196 --- [  restartedMain] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthContributorAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [com/alibaba/druid/spring/boot/autoconfigure/DruidDataSourceAutoConfigure.class]: Invocation of init method failed; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
   2020-01-17 14:34:43.375  INFO 7196 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
   2020-01-17 14:34:43.388  WARN 7196 --- [  restartedMain] o.a.c.loader.WebappClassLoaderBase       : The web application [producer] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@13.0.1/jdk.internal.misc.Unsafe.park(Native Method)
    java.base@13.0.1/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:235)
    java.base@13.0.1/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123)
    java.base@13.0.1/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
    java.base@13.0.1/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
    java.base@13.0.1/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
    java.base@13.0.1/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
    java.base@13.0.1/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    java.base@13.0.1/java.lang.Thread.run(Thread.java:830)
   2020-01-17 14:34:43.389  WARN 7196 --- [  restartedMain] o.a.c.loader.WebappClassLoaderBase       : The web application [producer] appears to have started a thread named [lettuce-eventExecutorLoop-1-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@13.0.1/jdk.internal.misc.Unsafe.park(Native Method)
    java.base@13.0.1/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:235)
    java.base@13.0.1/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2123)
    java.base@13.0.1/java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:458)
    app//io.netty.util.concurrent.SingleThreadEventExecutor.takeTask(SingleThreadEventExecutor.java:289)
    app//io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:64)
    app//io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1050)
    app//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    app//io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    java.base@13.0.1/java.lang.Thread.run(Thread.java:830)
   2020-01-17 14:34:43.391  WARN 7196 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
   2020-01-17 14:34:43.465 ERROR 7196 --- [  restartedMain] o.s.b.d.LoggingFailureAnalysisReporter   : 
   
   ***************************
   APPLICATION FAILED TO START
   ***************************
   
   Description:
   
   Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
   
   Reason: Failed to determine a suitable driver class
   
   
   Action:
   
   Consider the following:
   	If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
   	If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
   
   Disconnected from the target VM, address: '127.0.0.1:9200', transport: 'socket'
   
   Process finished with exit code 1
   ```
   -----------------------------------------------------------------------------------------------------------
   ```yml
     shardingsphere:  #分库分表
       dataSources:
         names:  ds0,ds1  #指定数据库
         ds0:
           type: com.alibaba.druid.pool.DruidDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           url: jdbc:mysql://mysql.ciel.cl:1600/ds0?seUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
           username: root
           password: ciel
         ds1:
           type: com.alibaba.druid.pool.DruidDataSource
           driverClassName: com.mysql.cj.jdbc.Driver
           url: jdbc:mysql://mysql.ciel.cl:1601/ds1?seUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai
           username: root
           password: ciel
       sharding:  # 分库策略 根据id取模确定数据进哪个数据库
         default-database-strategy:
           inline:
             sharding-column: id
             algorithm-expression: ds$->{id % 2}
         tables:   #具体分表策略 ,# 节点 ds0.t_order_0,ds0.t_order_1,ds1.t_order_0,ds1.t_order_1
           t_order:
             actual-data-nodes: ds$->{0..1}.t_order$->{0..2}
             table-strategy:
               inline:
                 sharding-column: id  # 分表字段id
                 algorithm-expression: t_order$->{id % 2} # 分表策略 根据id取模,确定数据最终落在那个表中
             key-generator: # 使用SNOWFLAKE算法生成主键
               column: id
               type: SNOWFLAKE
       #        t_order_item:
       #          actual-data-nodes: ds$->{0..1}.t_order_item$->{0..1}
       #          table-strategy:
       #            inline:
       #              sharding-column: order_id
       #              algorithm-expression: t_order_item$->{order_id % 2}
       props:
         sql:
           show: true #打印sql
   ```
   -------------------------------------------------------------------
   <!-- 分库分表 -->
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-boot-starter</artifactId>
               <version>4.0.0-RC3</version>
           </dependency>
   
           <!-- 分库分表 -->
           <dependency>
               <groupId>org.apache.shardingsphere</groupId>
               <artifactId>sharding-jdbc-spring-namespace</artifactId>
               <version>4.0.0-RC3</version>
           </dependency>

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services