Spring Boot 2.1.8和钱包的数据源连接OCI问题

问题描述 投票:0回答:1

我有一个带有 springboot 2.1.8 的 Web 应用程序,它连接到 2 个数据库,其中一个使用 WALLET 在 OCI 中。 我在属性文件中的配置如下(我省略了一些敏感数据):

#Configuration to OCI
datasource1.spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
datasource1.spring.datasource.jdbc-url=jdbc:oracle:thin:@bddociaddv?TNS_ADMIN=/u02/Admin/domains/domain1/wls12c/props/bddoci
datasource1.spring.datasource.username=username
datasource1.spring.datasource.password=pass

注意:在“jdbc-url”属性中,“TNS_ADMIN”中指示的路径指向具有解压缩配置的文件夹。

在我的 POM 文件中,我对 ojdbc 具有依赖关系:

        <!-- Uncomment this when using Oracle Credentials Wallet -->
        <dependency>
            <groupId>com.oracle.ojdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>${oracle.ojdbc.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>com.oracle.ojdbc</groupId>
                    <artifactId>simplefan</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.oracle.ojdbc</groupId>
                    <artifactId>ons</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

其中:${oracle.ojdbc.version} = [19,20)

问题是应用程序没有唤醒,日志显示如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2024-05-17 16:22:19,040 ERROR org.springframework.boot.SpringApplication [[ACTIVE] ExecuteThread: '11' for queue: 'weblogic.kernel.Default (self-tuning)'] Application run failed
# org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'xxxxxxEntityManagerFactory' defined in class path resource [com/domain/subdomain/repository1/model/XXXXXXDatasourceConfiguration.class]: Unsatisfied dependency expressed through method 'XXXXXXXEntityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.IllegalArgumentException: **jdbcUrl is required with driverClassName.**

Web 维护人员应该可以毫无问题地连接到 OCI 数据库:(

oracle spring-boot hikaricp oracle-cloud-infrastructure wallet
1个回答
0
投票

要使用钱包,您的pom中需要oraclepki工件,并且属性名称是datasource1.spring.datasource.url而不是jdbc-url。

© www.soinside.com 2019 - 2024. All rights reserved.