alibaba / druid

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

与spring-boot 2.2使用出错。 #3610

Closed design365 closed 11 months ago

design365 commented 4 years ago

错误日志:

java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExcludeAutoConfigurationsProperty(AutoConfigurationImportSelector.java:215) ~[spring-boot-autoconfigure-1.5.12.RELEASE.jar:1.5.12.RELEASE] at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExclusions(AutoConfigurationImportSelector.java:209) ~[spring-boot-autoconfigure-1.5.12.RELEASE.jar:1.5.12.RELEASE] at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:99) ~[spring-boot-autoconfigure-1.5.12.RELEASE.jar:1.5.12.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser$DefaultDeferredImportSelectorGroup.process(ConfigurationClassParser.java:888) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:874) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:325) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.2.RELEASE.jar:2.2.2.RELEASE] at start.Starter.main(Starter.java:11) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_231] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_231] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_231] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_231] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.2.2.RELEASE.jar:2.2.2.RELEASE] Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[na:1.8.0_231] at java.lang.ClassLoader.loadClass(ClassLoader.java:418) ~[na:1.8.0_231] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355) ~[na:1.8.0_231] at java.lang.ClassLoader.loadClass(ClassLoader.java:351) ~[na:1.8.0_231] ... 26 common frames omitted

pom.xml:

 <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>2.2.2.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.17</version>
    </dependency>

    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>druid-spring-boot-starter</artifactId>
        <version>1.1.17</version>
    </dependency>
chzhm159 commented 4 years ago

同问,我用的是这个版本

        <!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.1.21</version>
        </dependency>

启动报错

"D:\Program Files\jdk-8\bin\java.exe" -XX:TieredStopAtLevel=1 -noverify -Dspring.profiles.active=dev -Dspring.output.ansi.enabled=always "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\lib\idea_rt.jar=50476:D:\Program Files\JetBrains\IntelliJ IDEA 2019.2.4\bin" -Dfile.encoding=UTF-8 -classpath "D:\Program Files\jdk-8\jre\lib\charsets.jar;D:\Program Files\jdk-8\jre\lib\deploy.jar;D:\Program Files\jdk-8\jre\lib\ext\access-bridge-64.jar;D:\Program Files\jdk-8\jre\lib\ext\cldrdata.jar;D:\Program Files\jdk-8\jre\lib\ext\dnsns.jar;D:\Program Files\jdk-8\jre\lib\ext\jaccess.jar;D:\Program Files\jdk-8\jre\lib\ext\jfxrt.jar;D:\Program Files\jdk-8\jre\lib\ext\localedata.jar;D:\Program Files\jdk-8\jre\lib\ext\nashorn.jar;D:\Program Files\jdk-8\jre\lib\ext\sunec.jar;D:\Program Files\jdk-8\jre\lib\ext\sunjce_provider.jar;D:\Program Files\jdk-8\jre\lib\ext\sunmscapi.jar;D:\Program Files\jdk-8\jre\lib\ext\sunpkcs11.jar;D:\Program Files\jdk-8\jre\lib\ext\zipfs.jar;D:\Program Files\jdk-8\jre\lib\javaws.jar;D:\Program Files\jdk-8\jre\lib\jce.jar;D:\Program Files\jdk-8\jre\lib\jfr.jar;D:\Program Files\jdk-8\jre\lib\jfxswt.jar;D:\Program Files\jdk-8\jre\lib\jsse.jar;D:\Program Files\jdk-8\jre\lib\management-agent.jar;D:\Program Files\jdk-8\jre\lib\plugin.jar;D:\Program Files\jdk-8\jre\lib\resources.jar;D:\Program Files\jdk-8\jre\lib\rt.jar;D:\projects\timermanager\target\classes;C:\Users\carl.chenzhm\.m2\repository\com\alibaba\druid-spring-boot-starter\1.1.21\druid-spring-boot-starter-1.1.21.jar;C:\Users\carl.chenzhm\.m2\repository\com\alibaba\druid\1.1.21\druid-1.1.21.jar;C:\Users\carl.chenzhm\.m2\repository\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-autoconfigure\1.5.12.RELEASE\spring-boot-autoconfigure-1.5.12.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-devtools\2.2.2.RELEASE\spring-boot-devtools-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot\2.2.2.RELEASE\spring-boot-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-core\5.2.2.RELEASE\spring-core-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-jcl\5.2.2.RELEASE\spring-jcl-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-context\5.2.2.RELEASE\spring-context-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-actuator\2.2.2.RELEASE\spring-boot-starter-actuator-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter\2.2.2.RELEASE\spring-boot-starter-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-logging\2.2.2.RELEASE\spring-boot-starter-logging-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\ch\qos\logback\logback-classic\1.2.3\logback-classic-1.2.3.jar;C:\Users\carl.chenzhm\.m2\repository\ch\qos\logback\logback-core\1.2.3\logback-core-1.2.3.jar;C:\Users\carl.chenzhm\.m2\repository\org\apache\logging\log4j\log4j-to-slf4j\2.12.1\log4j-to-slf4j-2.12.1.jar;C:\Users\carl.chenzhm\.m2\repository\org\apache\logging\log4j\log4j-api\2.12.1\log4j-api-2.12.1.jar;C:\Users\carl.chenzhm\.m2\repository\org\slf4j\jul-to-slf4j\1.7.29\jul-to-slf4j-1.7.29.jar;C:\Users\carl.chenzhm\.m2\repository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;C:\Users\carl.chenzhm\.m2\repository\org\yaml\snakeyaml\1.25\snakeyaml-1.25.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-actuator-autoconfigure\2.2.2.RELEASE\spring-boot-actuator-autoconfigure-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-actuator\2.2.2.RELEASE\spring-boot-actuator-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.10.1\jackson-databind-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.10.1\jackson-annotations-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.10.1\jackson-core-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.10.1\jackson-datatype-jsr310-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\io\micrometer\micrometer-core\1.3.1\micrometer-core-1.3.1.jar;C:\Users\carl.chenzhm\.m2\repository\org\hdrhistogram\HdrHistogram\2.1.11\HdrHistogram-2.1.11.jar;C:\Users\carl.chenzhm\.m2\repository\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-web\2.2.2.RELEASE\spring-boot-starter-web-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-json\2.2.2.RELEASE\spring-boot-starter-json-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.10.1\jackson-datatype-jdk8-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.10.1\jackson-module-parameter-names-2.10.1.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-validation\2.2.2.RELEASE\spring-boot-starter-validation-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\jakarta\validation\jakarta.validation-api\2.0.1\jakarta.validation-api-2.0.1.jar;C:\Users\carl.chenzhm\.m2\repository\org\hibernate\validator\hibernate-validator\6.0.18.Final\hibernate-validator-6.0.18.Final.jar;C:\Users\carl.chenzhm\.m2\repository\org\jboss\logging\jboss-logging\3.3.2.Final\jboss-logging-3.3.2.Final.jar;C:\Users\carl.chenzhm\.m2\repository\com\fasterxml\classmate\1.3.4\classmate-1.3.4.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-web\5.2.2.RELEASE\spring-web-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-beans\5.2.2.RELEASE\spring-beans-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-webmvc\5.2.2.RELEASE\spring-webmvc-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-aop\5.2.2.RELEASE\spring-aop-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\spring-expression\5.2.2.RELEASE\spring-expression-5.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\org\springframework\boot\spring-boot-starter-jetty\2.2.2.RELEASE\spring-boot-starter-jetty-2.2.2.RELEASE.jar;C:\Users\carl.chenzhm\.m2\repository\jakarta\servlet\jakarta.servlet-api\4.0.3\jakarta.servlet-api-4.0.3.jar;C:\Users\carl.chenzhm\.m2\repository\jakarta\websocket\jakarta.websocket-api\1.1.2\jakarta.websocket-api-1.1.2.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-servlets\9.4.24.v20191120\jetty-servlets-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-continuation\9.4.24.v20191120\jetty-continuation-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-http\9.4.24.v20191120\jetty-http-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-util\9.4.24.v20191120\jetty-util-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-io\9.4.24.v20191120\jetty-io-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-webapp\9.4.24.v20191120\jetty-webapp-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-xml\9.4.24.v20191120\jetty-xml-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-servlet\9.4.24.v20191120\jetty-servlet-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-security\9.4.24.v20191120\jetty-security-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-server\9.4.24.v20191120\jetty-server-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\websocket-server\9.4.24.v20191120\websocket-server-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\websocket-common\9.4.24.v20191120\websocket-common-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\websocket-api\9.4.24.v20191120\websocket-api-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\websocket-client\9.4.24.v20191120\websocket-client-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-client\9.4.24.v20191120\jetty-client-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\websocket-servlet\9.4.24.v20191120\websocket-servlet-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\javax-websocket-server-impl\9.4.24.v20191120\javax-websocket-server-impl-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-annotations\9.4.24.v20191120\jetty-annotations-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\jetty-plus\9.4.24.v20191120\jetty-plus-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\ow2\asm\asm\7.2\asm-7.2.jar;C:\Users\carl.chenzhm\.m2\repository\org\ow2\asm\asm-commons\7.2\asm-commons-7.2.jar;C:\Users\carl.chenzhm\.m2\repository\org\ow2\asm\asm-tree\7.2\asm-tree-7.2.jar;C:\Users\carl.chenzhm\.m2\repository\org\ow2\asm\asm-analysis\7.2\asm-analysis-7.2.jar;C:\Users\carl.chenzhm\.m2\repository\org\eclipse\jetty\websocket\javax-websocket-client-impl\9.4.24.v20191120\javax-websocket-client-impl-9.4.24.v20191120.jar;C:\Users\carl.chenzhm\.m2\repository\org\mortbay\jasper\apache-el\8.5.49\apache-el-8.5.49.jar;D:\projects\timermanager\src\main\resources\libs\ojdbc14-10.2.0.5.0-20170917.jar" rd.software.timermanager.App
2020-01-08 17:00:37.692 DEBUG 15552 --- [  restartedMain] .c.l.ClasspathLoggingApplicationListener : Application started with classpath: [file:/D:/projects/timermanager/target/classes/]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.2.2.RELEASE)

2020-01-08 17:00:37.739 DEBUG 15552 --- [  restartedMain] o.s.c.e.PropertySourcesPropertyResolver  : Found key 'spring.application.name' in PropertySource 'configurationProperties' with value of type String
2020-01-08 17:00:37.739  INFO 15552 --- [  restartedMain] rd.software.timermanager.App             : Starting App on I-PC-00004584 with PID 15552 (D:\projects\timermanager\target\classes started by carl.chenzhm in D:\projects\timermanager)
2020-01-08 17:00:37.739 DEBUG 15552 --- [  restartedMain] rd.software.timermanager.App             : Running with Spring Boot v2.2.2.RELEASE, Spring v5.2.2.RELEASE
2020-01-08 17:00:37.739  INFO 15552 --- [  restartedMain] rd.software.timermanager.App             : The following profiles are active: dev
2020-01-08 17:00:37.739 DEBUG 15552 --- [  restartedMain] o.s.boot.SpringApplication               : Loading source class rd.software.timermanager.App
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.c.c.ConfigFileApplicationListener  : Activated activeProfiles dev
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.c.c.ConfigFileApplicationListener  : Loaded config file 'file:/D:/projects/timermanager/target/classes/application.yml' (classpath:/application.yml)
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.c.c.ConfigFileApplicationListener  : Profiles already activated, '[dev]' will not be applied
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.c.c.ConfigFileApplicationListener  : Loaded config file 'file:/D:/projects/timermanager/target/classes/application-dev.yml' (classpath:/application-dev.yml) for profile dev
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.devtools.restart.ChangeableUrls    : Matching URLs for reloading : [file:/D:/projects/timermanager/target/classes/]
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.d.settings.DevToolsSettings        : Included patterns for restart : []
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] o.s.b.d.settings.DevToolsSettings        : Excluded patterns for restart : [/spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/, /spring-boot/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter/target/classes/]
2020-01-08 17:00:37.770  INFO 15552 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2020-01-08 17:00:37.770  INFO 15552 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2020-01-08 17:00:37.770 DEBUG 15552 --- [  restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@624a54c7
2020-01-08 17:00:37.786 DEBUG 15552 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor'
2020-01-08 17:00:37.801 DEBUG 15552 --- [  restartedMain] o.s.b.f.s.DefaultListableBeanFactory     : Creating shared instance of singleton bean 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'
2020-01-08 17:00:37.817 DEBUG 15552 --- [kground-preinit] org.jboss.logging                        : Logging Provider: org.jboss.logging.Log4j2LoggerProvider
2020-01-08 17:00:37.817 DEBUG 15552 --- [kground-preinit] o.h.v.i.e.resolver.TraversableResolvers  : Cannot find javax.persistence.Persistence on classpath. Assuming non JPA 2 environment. All properties will per default be traversable.
2020-01-08 17:00:37.832 DEBUG 15552 --- [  restartedMain] o.s.c.a.ClassPathBeanDefinitionScanner   : Identified candidate component class: file [D:\projects\timermanager\target\classes\rd\software\timermanager\rest\TimerManager.class]
2020-01-08 17:00:37.879 ERROR 15552 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

java.lang.NoClassDefFoundError: org/springframework/boot/bind/RelaxedPropertyResolver
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExcludeAutoConfigurationsProperty(AutoConfigurationImportSelector.java:215)
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.getExclusions(AutoConfigurationImportSelector.java:209)
    at org.springframework.boot.autoconfigure.AutoConfigurationImportSelector.selectImports(AutoConfigurationImportSelector.java:99)
    at org.springframework.context.annotation.ConfigurationClassParser$DefaultDeferredImportSelectorGroup.process(ConfigurationClassParser.java:888)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGrouping.getImports(ConfigurationClassParser.java:874)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:801)
    at org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:771)
    at org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:188)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:325)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:242)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:275)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:95)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at rd.software.timermanager.App.main(App.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.bind.RelaxedPropertyResolver
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 26 common frames omitted

2020-01-08 17:00:37.879 DEBUG 15552 --- [  restartedMain] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@624a54c7, started on Wed Jan 08 17:00:37 CST 2020
Picked up JAVA_TOOL_OPTIONS: -Djava.vendor="Sun Microsystems Inc."

Process finished with exit code 0
chzhm159 commented 4 years ago

@design365 org/springframework/boot/bind/RelaxedPropertyResolver 已经被删了 但,暂时我没找到是哪里引用了这个

chzhm159 commented 4 years ago

请 @lihengming 指教. 我现在能确定是加入了 这个 starter 之后引发的问题, 但是没搜到哪些代码中import了这个 org/springframework/boot/bind/RelaxedPropertyResolver 类. 我用的是spring-boot 2.2.2 release.

能否给个思路,或者应该往哪个方向上寻找?

chzhm159 commented 4 years ago

@lihengming 我好像知道是哪里问题的了. 这个 starter 中依赖的还是 spring-boot 1.5.12.RELEASE

<properties>
        <druid.version>1.1.18</druid.version>
        <spring-boot.version>1.5.12.RELEASE</spring-boot.version>
    </properties>

<dependencyManagement>
        <dependencies>
            <dependency>
...
              <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
...
        </dependencies>
    </dependencyManagement>

在我手动修改 jar 包中的 pom.xml 文件,然后对项目 clean ,reimport 之后,之前的错误没了,但是出现新问题.... 见下文

chzhm159 commented 4 years ago

新错误.....

2020-01-09 10:14:19.480 DEBUG 21296 --- [  restartedMain] o.s.boot.diagnostics.FailureAnalyzers    : FailureAnalyzer org.springframework.boot.autoconfigure.jdbc.HikariDriverConfigurationFailureAnalyzer@6245990b failed

java.lang.TypeNotPresentException: Type org.springframework.jdbc.CannotGetJdbcConnectionException not present
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
    at sun.reflect.generics.repository.ClassRepository.getSuperclass(ClassRepository.java:90)
    at java.lang.Class.getGenericSuperclass(Class.java:777)
    at org.springframework.core.ResolvableType.getSuperType(ResolvableType.java:467)
    at org.springframework.core.ResolvableType.as(ResolvableType.java:456)
    at org.springframework.core.ResolvableType.forClass(ResolvableType.java:1035)
    at org.springframework.boot.diagnostics.AbstractFailureAnalyzer.getCauseType(AbstractFailureAnalyzer.java:56)
    at org.springframework.boot.diagnostics.AbstractFailureAnalyzer.analyze(AbstractFailureAnalyzer.java:33)
    at org.springframework.boot.diagnostics.FailureAnalyzers.analyze(FailureAnalyzers.java:111)
    at org.springframework.boot.diagnostics.FailureAnalyzers.reportException(FailureAnalyzers.java:104)
    at org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:816)
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:801)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:325)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at rd.software.timermanager.App.main(App.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.CannotGetJdbcConnectionException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
    ... 25 common frames omitted

2020-01-09 10:14:19.496 ERROR 21296 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSource': Unsatisfied dependency expressed through field 'basicProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
    at rd.software.timermanager.App.main(App.java:16)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1320)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1287)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1207)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
    ... 24 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:213)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1312)
    ... 35 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/jdbc/datasource/embedded/EmbeddedDatabaseType
    at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.<clinit>(EmbeddedDatabaseConnection.java:51)
    at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.<init>(DataSourceProperties.java:152)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:200)
    ... 37 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 44 common frames omitted
chzhm159 commented 4 years ago

@design365 这位兄弟 ... 我的问题解决了,我漏了

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

加上之后,我的就正常启动了