Record once the solution of gradle dependency problem: failed to determine a suitable driver class

problem keyword

Failed to determine a suitable driver class

problem description

error message is as follows:

2019-03-06 09:53:43.991|localhost-startStop-1|INFO |o.s.cloud.alibaba.sentinel.SentinelWebAutoConfiguration.servletRequestListener:73|[Sentinel Starter] register Sentinel with urlPatterns: [/*].
2019-03-06 09:53:44.723|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'commonFilter' to urls: [/*]
2019-03-06 09:53:44.723|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'characterEncodingFilter' to: [/*]
2019-03-06 09:53:44.723|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'httpPutFormContentFilter' to: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'requestContextFilter' to: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'cat-filter' to urls: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'sentinelFilter' to urls: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'httpCatCrossFliter' to urls: [/*]
2019-03-06 09:53:44.724|localhost-startStop-1|INFO |o.s.boot.web.servlet.FilterRegistrationBean.log:87|Mapping filter: 'corsInterceptor' to: [/*]
2019-03-06 09:53:44.725|localhost-startStop-1|INFO |o.s.boot.web.servlet.ServletRegistrationBean.log:87|Servlet dispatcherServlet mapped to [/]
2019-03-06 09:53:44.795|restartedMain|INFO |org.springframework.aop.framework.CglibAopProxy.log:87|Method [void com.zaxxer.hikari.HikariConfig.seal()] is package-visible across different ClassLoaders and cannot get proxied via CGLIB: Declare this method as public or protected if you need to support invocations through the proxy.
2019-03-06 09:53:44.956|restartedMain|WARN |o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext.log:87|Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-03-06 09:53:44.961|restartedMain|WARN |o.s.beans.factory.support.DisposableBeanAdapter.log:87|Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-03-06 09:53:44.997|restartedMain|INFO |org.apache.catalina.core.StandardService.log:180|Stopping service [Tomcat]
2019-03-06 09:53:45.024|localhost-startStop-1|WARN |org.apache.catalina.loader.WebappClassLoaderBase.log:180|The web application [api] appears to have started a thread named [sentinel-datasource-auto-refresh-task-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
2019-03-06 09:53:45.025|localhost-startStop-1|WARN |org.apache.catalina.loader.WebappClassLoaderBase.log:180|The web application [api] appears to have started a thread named [sentinel-metrics-record-task-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
 java.lang.Thread.run(Thread.java:748)
Disconnected from the target VM, address: '127.0.0.1:59182', transport: 'socket'

Process finished with exit code 1

think about the cause

after adding a dependency

check cause

to see if this dependency depends on some other dependency,
looks and does so;

solution

excludes the dependency

    compile 'com.xxx.cloud:xxx-client:0.0.1-SNAPSHOT' , {
        exclude(module: 'spring-boot-starter-data-jpa')
    }

Read More: