简体   繁体   English

Spring 无法在类路径中找到 *is* 的驱动程序类

[英]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.我正在尝试在包含一个数据源的 tomcat 服务器上运行 springboot 应用程序,该数据源能够与保险库通信并在运行时更改数据库凭据。 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.我在此代码中所做的唯一更改是添加一些与 Vault 通信所必需的属性,并更改数据源配置以包含这些 Vault 更改。

I get the following error during startup:我在启动过程中收到以下错误:

Description: Cannot determine embedded database driver class for database type NONE说明:无法确定数据库类型 NONE 的嵌入式数据库驱动程序类

However, in my application.properties file I DO have the driver class specified...但是,在我的 application.properties 文件中,我确实指定了驱动程序类...

spring.datasource.hikari.driverClassName=com.ibm.db2.jcc.DB2Driver 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.在 pom 文件中,我有正确的依赖项,因此驱动程序实际上包含在类路径中......我什至在 Intellij 的“外部库”下拉菜单中看到了 jar。

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.我试过在我的@Configuration类上包含一个@Import注释,它指向保险库配置。 I've tried adding a @ComponentScan on my application class to try and really get it to look at the config and properties properly.我已经尝试在我的应用程序类上添加一个@ComponentScan来尝试并真正让它正确查看配置和属性。

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.请提供代码片段。所以,我可以调试它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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