alibaba / druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
https://github.com/alibaba/druid/wiki
Apache License 2.0
28k stars 8.59k forks source link

使用springboot3+jetty+druid启动时: Failed to bind properties under 'spring.datasource.druid.password-callback' to javax.security.auth.callback.PasswordCallback #5997

Open 970776893 opened 5 months ago

970776893 commented 5 months ago

使用springboot3+jetty+druid启动时,报错

错误日志日下:

2024-06-23 19:48:21.056 [,] [main] DEBUG org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter report:37 - Application failed to start due to an exception
org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'spring.datasource.druid.password-callback' to javax.security.auth.callback.PasswordCallback
    at org.springframework.boot.context.properties.bind.Binder.handleBindError(Binder.java:392) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:352) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$4(Binder.java:478) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:99) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:87) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.JavaBeanBinder.bind(JavaBeanBinder.java:63) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:337) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:267) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:254) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBinder.bind(ConfigurationPropertiesBinder.java:94) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.bind(ConfigurationPropertiesBindingPostProcessor.java:96) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor.postProcessBeforeInitialization(ConfigurationPropertiesBindingPostProcessor.java:79) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:419) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1760) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:596) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:903) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:903) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:903) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:903) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:781) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1330) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1160) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:558) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:518) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:313) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-6.0.19.jar!/:6.0.19]
    at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1168) ~[spring-context-6.0.19.jar!/:6.0.19]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:942) ~[spring-context-6.0.19.jar!/:6.0.19]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:615) ~[spring-context-6.0.19.jar!/:6.0.19]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:324) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at com.huawei.csm.service.AlpsMicroServiceApplication.main(AlpsMicroServiceApplication.java:87) ~[classes!/:1.0]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[microservice-1.0.jar:1.0]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:95) ~[microservice-1.0.jar:1.0]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[microservice-1.0.jar:1.0]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65) ~[microservice-1.0.jar:1.0]
Caused by: java.lang.IllegalStateException: Failed to extract parameter names for public javax.security.auth.callback.PasswordCallback(java.lang.String,boolean)
    at org.springframework.util.Assert.state(Assert.java:97) ~[spring-core-6.0.19.jar!/:6.0.19]
    at org.springframework.boot.context.properties.bind.ValueObjectBinder$DefaultValueObject.parseConstructorParameters(ValueObjectBinder.java:272) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.ValueObjectBinder$DefaultValueObject.<init>(ValueObjectBinder.java:266) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.ValueObjectBinder$DefaultValueObject.get(ValueObjectBinder.java:295) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.ValueObjectBinder$ValueObject.get(ValueObjectBinder.java:198) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.ValueObjectBinder.bind(ValueObjectBinder.java:67) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.lambda$bindDataObject$5(Binder.java:482) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder$Context.withIncreasedDepth(Binder.java:596) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder$Context.withDataObject(Binder.java:582) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bindDataObject(Binder.java:480) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:419) ~[spring-boot-3.1.11.jar!/:3.1.11]
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:348) ~[spring-boot-3.1.11.jar!/:3.1.11]
    ... 98 more

核心配置如下:

tomcat容器启动时的mavn依赖:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>3.1.11</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-validator</artifactId>
                <groupId>org.hibernate.validator</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>2.7.10</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.2.23</version>
    </dependency>
</dependencies>

jetty容器启动时的mavn依赖:

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>3.1.11</version>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-logging</artifactId>
            </exclusion>
            <exclusion>
                <artifactId>hibernate-validator</artifactId>
                <groupId>org.hibernate.validator</groupId>
            </exclusion>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
        <version>3.1.11</version>
    </dependency>
    <dependency>
        <groupId>jakarta.servlet</groupId>
        <artifactId>jakarta.servlet-api</artifactId>
        <version>5.0.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>2.7.10</version>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid</artifactId>
        <version>1.2.23</version>
    </dependency>
</dependencies>

jdbc配置(全部配置-无遗漏)

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql://xxxx:xxxx/master?characterEncoding=UTF-8
spring.datasource.username=xxxx
spring.datasource.password=xxxx

spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
spring.datasource.druid.test-while-idle=false
spring.datasource.druid.test-on-borrow=true
spring.datasource.druid.validation-query=select 1+1
spring.datasource.druid.use-global-data-source-stat=false
spring.datasource.druid.async-init=false
spring.datasource.druid.filters=stat,slf4j
spring.datasource.druid.time-between-eviction-runs-millis=60000
spring.datasource.druid.fail-fast=true
spring.datasource.druid.min-evictable-idle-time-millis=1800000
spring.datasource.druid.max-evictable-idle-time-millis=25200000
spring.datasource.druid.keep-alive=true
spring.datasource.druid.pool-prepared-statements=false
spring.datasource.druid.initial-size=30
spring.datasource.druid.min-idle=30
spring.datasource.druid.max-active=500
spring.datasource.druid.max-wait=60000
spring.datasource.druid.connection-properties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000;druid.stat.logSlowSql=true;connectTimeout=60000;socketTimeout=60000
spring.datasource.druid.max-pool-prepared-statement-per-connection-size=100

使用的是openjdk17,下载地址:https://github.com/adoptium/temurin17-binaries/releases/tag/jdk-17.0.10%2B7

场景说明

  1. 使用tomcat容器启动,正常启动
  2. 使用jetty容器启动,使用openjdk17中的jdk,正常启动
  3. 使用jetty容器启动,使用openjdk17中的jre,报该错误
IceOfSummer commented 4 months ago

同样的报错,加上下面的代码就解决了,但是不知道会有什么额外的副作用,反正问题是解决了。。。

@ConfigurationProperties(value = "spring.datasource.druid", ignoreInvalidFields = true)
public class CustomDataSourceWrapper extends DruidDataSourceWrapper { }
@Configuration
@EnableConfigurationProperties(CustomDataSourceWrapper.class)
public class DatasourceConfiguration { }
970776893 commented 4 months ago

同样的报错,加上下面的代码就解决了,但是不知道会有什么额外的副作用,反正问题是解决了。。。

@ConfigurationProperties(value = "spring.datasource.druid", ignoreInvalidFields = true)
public class CustomDataSourceWrapper extends DruidDataSourceWrapper { }
@Configuration
@EnableConfigurationProperties(CustomDataSourceWrapper.class)
public class DatasourceConfiguration { }

最好发一个版本解决,不要让我们定制化去改(被封装了,改不了)。

如果真实配置了这个属性,还是有问题啊 spring.datasource.druid.password-callback.xxx