国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Reason: Failed to determine a suitable driver class 項目啟動報錯解決

這篇具有很好參考價值的文章主要介紹了Reason: Failed to determine a suitable driver class 項目啟動報錯解決。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

今天遇到了這個問題,因為在網(wǎng)關(guān)服務(wù)的pom.xml文件中引用了其他模塊,而其他模塊有DataSource相關(guān)的依賴,我的配置文件中沒有對應(yīng)的配置,所以報錯了。順便總結(jié)一下吧

報錯信息如下:

2021-04-01 10:47:19.255 ERROR 3249 --- [ ?restartedMain] o.s.b.d.LoggingFailureAnalysisReporter ? :?

***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

Reason:?Failed to determine a suitable driver class


Action:

Consider the following:
?? ?If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
?? ?If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).


Process finished with exit code 0

排查錯誤的原因:

情況一:服務(wù)沒有用到DataSource,但是pom.xml中引入了jdbc或者 Mybatis相關(guān)的依賴。

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

情況二:服務(wù)沒有用到DataSource,pom.xml引入其他模塊,而其他模塊中有jdbc或者和mybatis相關(guān)的依賴.

比如網(wǎng)關(guān)模塊中引入了leadstore-user這個模塊,而leadstore-user這個依賴里面有mybatis-plus相關(guān)的依賴,網(wǎng)關(guān)的application.yml文件中又沒有配置DataSource

        <dependency>
            <groupId>com.heima</groupId>
            <artifactId>leadstore-user</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>

這樣的話,在springboot工程啟動的時候回自動初始化DataSource相關(guān)的信息,但是卻找不到,則會報錯

解決方案:

方案一:1. 首先檢查第一種情況,排查pom.xml中的依賴,把jdbc和mybatis相關(guān)的依賴刪除;如果是需要用到的,在配置文件中添加相對應(yīng)的配置,如果有添加了的話,檢查一下url有沒有錯誤

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    url: jdbc:mysql://localhost:3306/leadstore_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useUnicode=true&useSSL=true
    username: root
    password: root

另外需要注意一下的:?

1. jar包可能沖突:使用maven-helper檢查jar包是否沖突,沖突就更換下jar包版本

Reason: Failed to determine a suitable driver class 項目啟動報錯解決

?

2. MySQL版本過高的話,application.yml文件中配置?url: &useSSL=false 會有沒用的情況?

方案二:不在application.yml中配置,在啟動類的@SpringBootApplication加上(推薦):

@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })

或者在application.properties里配置:

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration,org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration

大概這樣,遇到其他問題再回來補充。文章來源地址http://www.zghlxwxcb.cn/news/detail-446477.html

到了這里,關(guān)于Reason: Failed to determine a suitable driver class 項目啟動報錯解決的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • DBeaver連接sqlserver報錯“Reason: can‘t load driver class ‘com.microsoft.sqlserver.jdbc.SQLServerDriver‘”

    DBeaver連接sqlserver報錯“Reason: can‘t load driver class ‘com.microsoft.sqlserver.jdbc.SQLServerDriver‘”

    報錯詳情: Can\\\'t create driver instance Error creating driver \\\'MS SQL Server / SQL Server\\\' instance. Most likely required jar files are missing. You should configure jars in driver settings. Reason: can\\\'t load driver class \\\'com.microsoft.sqlserver.jdbc.SQLServerDriver\\\' Error creating driver \\\'MS SQL Server / SQL Server\\\' instance. Most likely required jar

    2024年02月05日
    瀏覽(32)
  • SpringBoot微服務(wù)項目報錯:Failed to process import candidates for configuration class [springfox.boot...

    SpringBoot微服務(wù)項目報錯:Failed to process import candidates for configuration class [springfox.boot...

    [main] ERROR org.springframework.boot.SpringApplication - Application run failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to process import candidates for configuration class [springfox.boot.starter.autoconfigure.OpenApiAutoConfiguration]; nested exception is java.io.FileNotFoundException: class path resource [springfox/document

    2024年01月17日
    瀏覽(27)
  • 【SpringBoot中使用SLE4J日志框架啟動報錯:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinde】

    【SpringBoot中使用SLE4J日志框架啟動報錯:SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinde】

    1.1 出現(xiàn)的問題 SLF4J: Failed to load class “org.slf4j.impl.StaticLoggerBinder”. SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 1.2 原因分析 檢查自己的maven依賴,發(fā)現(xiàn)已經(jīng)引入了slf4j-api了,這是為什么呢?其原因是,SLF4J本身

    2024年02月13日
    瀏覽(21)
  • Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [properties]

    Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [properties]

    Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [properties]: Root mapping definition has unsupported parameters: ? 我們在使用RestClient創(chuàng)建索引庫時出現(xiàn)了這個錯誤。 可以檢查一下 CreateIndexRequest 類型變量request 是否導(dǎo)入正確的包 有兩個同名的包,我們選擇: 創(chuàng)建的索引

    2024年02月11日
    瀏覽(24)
  • elasticsearch創(chuàng)建索引報[type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]......

    elasticsearch創(chuàng)建索引報[type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]......

    小伙伴們,你們好,我是老寇 經(jīng)過反復(fù)排查,發(fā)現(xiàn)是安裝的pinyin和ik分詞版本不對,只需要修改成與es版本一致即可 es 7.6.2 舉例 1.在windows界面用壓縮軟件打開elasticsearch-analysis-ik-7.6.2.jar 2.將pom.xml拖出到桌面 3.修改版本 4.將pom.xml放回壓縮包( 原路放回 ) 5. elasticsearch-analysis

    2024年02月13日
    瀏覽(28)
  • Spring boot 項目Kafka Error connecting to node xxx:xxx Kafka項目啟動異常 Failed to construct kafka consumer

    Spring boot 項目Kafka Error connecting to node xxx:xxx Kafka項目啟動異常 Failed to construct kafka consumer

    新建了一個springBoot集成Kafka的項目配置好yml后發(fā)現(xiàn)啟動失?。?下面是Kafka配置: node1:9092,node2:9092,node3:9092 是kafka的主機名,我是由之前的舊項目(非springBoot)遷移到新建項目的,所以鏈接名就直接抄過來了。 我以為是鏈接出了問題,我就換成ip形式,把node1:9092,node2:9092,node

    2023年04月08日
    瀏覽(27)
  • 解決 libGL error: failed to load driver: swrast

    運行圖形工具報錯: $ gvim libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast 網(wǎng)上查資料說,安裝Mesa-32bit 軟件包可以解決。所以安裝了很多mesa i386的軟件包,如下: 安裝完成后,確實好了。

    2024年02月12日
    瀏覽(89)
  • Failed to initialize NVML: Driver/library version mismatch

    Failed to initialize NVML: Driver/library version mismatch

    昨天跑代碼,cuda還能好好的to(device),今天就不行了。輸出 torch.cuda.is_available() 顯示False,運行代碼出現(xiàn)以下錯誤: 在終端輸入nvidia-smi出現(xiàn)了以下錯誤 上網(wǎng)查詢,發(fā)現(xiàn)了許多解決方法。為了更好的解決問題,并且避免再次出現(xiàn),我對這些方法進行了簡單的整理。希望能夠幫到

    2024年02月02日
    瀏覽(15)
  • Failed to initialize NVML: Driver/library version mismatch (解決)

    Failed to initialize NVML: Driver/library version mismatch (解決)

    運行 nvidia-smi 報錯: 只需一步:下載一個安裝包,運行一個命令來重新安裝 cuda driver 和 cuda toolkit (在一個包里)。 到這里:https://developer.nvidia.com/cuda-toolkit-archive 選擇要下載的安裝包。 點擊要下載的版本后,下載對應(yīng)的安裝包,這個安裝包包括 Driver(驅(qū)動) Cuda toolkit (工具

    2024年02月16日
    瀏覽(20)
  • PCB解決(Failed to add class member)問題

    PCB解決(Failed to add class member)問題

    今天畫板子時候發(fā)現(xiàn)一個之前沒遇到的問題,就是在生成PCB時候會提示你Failed to add class member : XXX(未能添加類成員:XXX),然后同時會發(fā)現(xiàn)有些器件會提示不知道引腳,問題如圖所示: 查了一下網(wǎng)上沒有發(fā)現(xiàn)問題原圖, 倒是有兩個解決方案,一個是在創(chuàng)建一個PCB文件,在重新

    2024年02月13日
    瀏覽(18)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包