簡體   English   中英

java.lang.ClassNotFoundException:無法加載請求的類:org.hibernate.dialect.Oracle12cDialect

[英]java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.Oracle12cDialect

我在編譯我的應用程序時遇到問題,原因是:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
    Caused by: org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [org.hibernate.dialect.Oracle12cDialect     ] as strategy [org.hibernate.dialect.Dialect]
    Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.hibernate.dialect.Oracle12cDialect     ]
    Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.hibernate.dialect.Oracle12cDialect

但是,jar 在 pom.xml 中:

<dependency>
    <groupId>oracle</groupId>
    <!-- <artifactId>ojdbc7</artifactId> -->
    <!-- <version>12.1.0.1</version> -->
    <artifactId>ojdbc8</artifactId>
    <version>12.2.0.1</version>
</dependency>

您可以在hibernate-core-5.0.11 中找到 hibernate.dialect.Oracle12cDialect。

而不是 OJDBC,升級你的休眠核心依賴,

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.0.11.Final</version>
</dependency>

或任何高於 5.0.11 的版本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM