![](/img/trans.png)
[英]Hibernate error: java.lang.ClassNotFoundException: Could not load requested class
[英]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.