Das Gleiche funktioniert nach der Idee einwandfrei und kann mit Postman getestet werden
Code: Select all
Failed to instantiate com.zaxxer.hikari.HikariDataSource: Factory method 'dataSource'exception with message: Failed to determine suitable driver class
Code: Select all
spring.datasource.url= jdbc:sqlserver://localhost:1433;encrypt=true;trustServerCertificate=true;databaseName=The_Read
spring.datasource.password= Read@123456
spring.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
Gradle-Abhängigkeiten
Code: Select all
dependencies {
implementation('org.springframework.boot:spring-boot-starter-web')
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-security:3.0.1')
implementation 'org.projectlombok:lombok:1.18.24'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
annotationProcessor 'org.projectlombok:lombok'
compileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
implementation 'io.swagger.core.v3:swagger-models:2.2.7'
implementation 'io.swagger.core.v3:swagger-annotations:2.2.6'
implementation 'io.swagger:swagger-annotations:1.6.8'
// https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2
implementation("org.springframework.security.oauth:spring-security-oauth2:2.5.2.RELEASE")
//implementation("org.springframework.security:spring-security-oauth2-jose:5.3.8.RELEASE")
implementation("org.springframework.security:spring-security-oauth2-jose:5.7.3")
Implementierungsgruppe: 'com.auth0', Name: 'java-jwt' , Version: '4.2.2'
// https://mvnrepository.com/artifact/org. ... urity-core
Implementierungsgruppe: 'org.springframework.security', Name: 'spring-security-core', Version: '6.0.1'
Implementierungsgruppe: 'org.springframework.security', Name: 'spring- security-oauth2-resource-server', Version: '5.1.6.RELEASE'
//Vielen Dank für die Verwendung von https://jar-download.com
// https://mvnrepository.com/artifact/com. ... mssql-jdbc
implementation("com.microsoft.sqlserver:mssql-jdbc:11.2.3.jre18")
// https ://mvnrepository.com/artifact/javax.annotation/javax.annotation-api
implementation("javax.annotation:javax.annotation-api:1.3.2")
implementation("org.springframework.security:spring-security-oauth2-resource-server:5.1.0.RELEASE")
Code: Select all
annotationProcessor "org.projectlombok:lombok:1.18.8"
testAnnotationProcessor("org.projectlombok:lombok:1.18.8")
// https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt
implementation("io.jsonwebtoken:jjwt:0.9.1")
// https://mvnrepository.com/artifact/javax.validation/validation-api
implementation("javax.validation:validation-api:2.0.1.Final")
implementation("javax.xml.bind:jaxb-api:2.3.1")
implementation("org.apache.commons:commons-lang3:3.0")
Protokoll-Stacktrace
Code: Select all
2023-01-25 02:07:10 20:37:10.777 [main] WARN org.springframework.context.annotation.AnnotationConfigApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
2023-01-25 02:07:10 20:37:10.782 [main] ERROR org.springframework.boot.SpringApplication - Application run failed
2023-01-25 02:07:10 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration': Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:798)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1344)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1188)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:415)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
2023-01-25 02:07:10 at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1130)
2023-01-25 02:07:10 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:905)
2023-01-25 02:07:10 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:584)
2023-01-25 02:07:10 at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:730)
2023-01-25 02:07:10 at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:432)
2023-01-25 02:07:10 at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
2023-01-25 02:07:10 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
2023-01-25 02:07:10 at org.springframework.boot.SpringApplication.run(SpringApplication.java:1291)
2023-01-25 02:07:10 at SecurityServiceApplication.main(SecurityServiceApplication.java:9)
2023-01-25 02:07:10 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:645)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1324)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1161)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:561)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:521)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
2023-01-25 02:07:10 at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1405)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1325)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789)
2023-01-25 02:07:10 ... 27 common frames omitted
2023-01-25 02:07:10 Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class
2023-01-25 02:07:10 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
2023-01-25 02:07:10 ... 41 common frames omitted
2023-01-25 02:07:10 Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2023-01-25 02:07:10 at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:182)
2023-01-25 02:07:10 at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.initializeDataSourceBuilder(DataSourceProperties.java:123)
2023-01-25 02:07:10 at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:48)
2023-01-25 02:07:10 at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari.dataSource(DataSourceConfiguration.java:90)
2023-01-25 02:07:10 at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
2023-01-25 02:07:10 at java.base/java.lang.reflect.Method.invoke(Method.java:577)
2023-01-25 02:07:10 at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139)
2023-01-25 02:07:10 ... 42 common frames omitted