您好,我正在使用 Oracle 数据库,但在 Spring Boot 中出现一些错误: 错误是:
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 javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to open JDBC Connection for DDL execution
我的应用程序属性是:
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.datasource.url= jdbc:oracle:thin:@localhost:1521:XE
spring.datasource.username=Sys
spring.datasource.password=admin
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.jpa.hibernate.ddl-auto=create
server.port = 8080
spring.jpa.show-sql=true
spring.servlet.multipart.max-file-size=-1
最佳答案
您使用的是哪个 Java 版本?您可以检查一下您的构建文件中是否添加了依赖项吗?
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
关于java - 无法打开 JDBC 连接 oracle 和 spring boot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61391388/