慕田峪9158850
2021-05-31 10:09:39
我有一個spring boot項目,當(dāng)我通過eclipse執(zhí)行時它運行得很好 Project > Run as > spring boot app但是當(dāng)我構(gòu)建項目并java -jar myproject.jar使用mvn spring-boot:run它執(zhí)行或使用它運行它時會拋出此錯誤Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:Property: driverclassnameValue: com.microsoft.sqlserver.jdbc.SQLServerDriverOrigin: "driverClassName" from property source "source"Reason: Failed to load driver class com.microsoft.sqlserver.jdbc.SQLServerDriver in either of HikariConfig class loader or Thread context classloaderAction:Update your application's configuration我的 sql server 連接器依賴項<dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>6.4.0.jre8</version> <scope>test</scope></dependency>這里是我的 application.propertiesspring.datasource.url=jdbc:sqlserver://mydb;databaseName=HTSdbspring.datasource.username=xxxspring.datasource.password=xxxspring.jpa.show-sql=truespring.jpa.hibernate.dialect=org.hibernate.dialect.SQLServer2012Dialect看起來我的應(yīng)用程序找不到 sqlserver 驅(qū)動程序,但它已經(jīng)在項目類路徑中,有什么建議嗎?提前致謝
2 回答

森欄
TA貢獻(xiàn)1810條經(jīng)驗 獲得超5個贊
Failed to bind properties under '' to com.zaxxer.hikari.HikariDataSource:
Property: driver-class-name
Value: org.postgresql.Driver
Origin: "driverClassName" from property source "source"
Reason: Failed to load driver class org.postgresql.Driver in either of HikariConfig
class loader or Thread context classloader
Action:
Update your application's configuration
只是有同樣的錯誤,在我的例子中是“org.postgresql.Driver”。猜猜是什么問題?錯誤地在“org.postgresql.Driver”之后出現(xiàn)了一個空格。
因此,請注意“ ” 不可見的空白空間:)。
添加回答
舉報
0/150
提交
取消