简体   繁体   中英

Spring can't locate a driver class that *is* in the classpath

I'm trying to run a springboot app on a tomcat server that includes a datasource that's able to communicate with a vault and change db credentials during runtime. The only change I've made in this code is adding some properties that are necessary to communicate with the vault, and changing the datasource configuration to include these vault changes.

I get the following error during startup:

Description: Cannot determine embedded database driver class for database type NONE

However, in my application.properties file I DO have the driver class specified...

spring.datasource.hikari.driverClassName=com.ibm.db2.jcc.DB2Driver

and in the pom file, I have the correct dependency so the driver is infact included in the classpath... I even see the jar in Intellij's 'External Libraries' drop down.

Again, I've not made many changes besides adding in addtional properties for our vault... and changing the code inside our datasource config to use the vault.

I've compared my changes against another module in which I did the exact same thing, and didn't have this issue at all there.

Does anyone have any ideas as to why this is happening, or suggestions on what I can try?

I've tried including a @Import annotation on my @Configuration class, which points to the vault configuration. I've tried adding a @ComponentScan on my application class to try and really get it to look at the config and properties properly.

If any further detail is required please just let me know. Thanks in advance for any and all help that can be offered.

I have faced same problem and got resolved by below annotation

@SpringDataApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})

please provide code snippet.So, i can debug it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM