当前位置: 首页 > 知识库问答 >
问题:

尝试用jasypt加密值连接oracle数据库时出错

曹渝
2023-03-14

我正在尝试使用camel-jasypt生成的加密密码和用户名与oracle数据库连接,并将生成的值保留在.properties文件中。但是,不幸的是,我遇到了用户名和密码不正确的错误。我正在提供我的程序的骆驼上下文。

    <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent"/>
        <property name="location" value="classpath:DB.properties"/>
        <property name="propertiesParser" ref="jasypt"/>
    </bean>
       <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:xe"/>
        <property name="username" value="${db.username}"/>
        <property name="password" value="${db.password}"/>
         </bean>
       </beans>
            db.driverClassName=oracle.jdbc.driver.OracleDriver
            db.url=jdbc:oracle:thin:@127.0.0.1:1521:xe
            db.username=ENC(/leiK3jiyKe1y87A8i743g==)
            db.password=ENC(3bwhRqBKu1Pye4Z+gBz9mm9q5Nxgah0n)

当我试图用.properties文件中的加密值与oracle数据库连接时,我会遇到以下错误

[ERROR] Error occurred while running main from: org.apache.camel.spring.Main
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'properties' defined in file [C:\Users\761285\workspace\camel-jasyp\target\classes\META-INF\spring\camelContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'camel-1': Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean with name 'dataSource' defined in file [C:\Users\rahul\workspace\camel-jasyp\target\classes\META-INF\spring\camelContext.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
(ClassPathXmlApplicationContext.java:93)

共有1个答案

卢磊
2023-03-14

基于例外情况:

nested exception is 
  org.springframework.beans.factory.CannotLoadBeanClassException: 
    Cannot find class [org.apache.commons.dbcp.BasicDataSource] for bean 
    with name 'dataSource' 

应用程序找不到这个类,您必须将apache-common.jar添加到pom或类路径或存储库的任何地方。

 类似资料:
  • 尝试使用cmd连接SQL数据库时出错。这是我的节目。我使用jdk 6版本来编译和运行,谢谢。 错误:

  • 错误:.错误:在function.module._resolveFilename(module.js:336:15)在function.module._load(module.js:278:25)在module.require(module.js:365:17)在require(module.js:384:17)在object处找不到模块“../build/release/oracle_bindi

  • 我正在尝试一个程序来检查与oracle数据库的连接,如下所示 但在eclipse中运行之后,它显示了以下异常。 JAVAsql。SQLException:Listener拒绝了连接,出现以下错误:ORA-12505,TNS:Listener当前不知道连接描述符中给出的SID 请帮助我,我是oracle数据库的新手。

  • 问题内容: 将Java运行时更改为1.6后,我面临oracle db连接问题。之前我们的应用程序使用1.5 Java运行时,现在我们正在迁移1.6。尝试连接到oracle 10g db时,应用程序引发以下异常: 失败了 错误:验证操作失败。错误:[ORACLE-10002:从与Oracle数据库+ ASM的连接接收到错误:java.lang.SecurityException:违反密封:封装了or

  • 我正在使用Heroku,并创建了一个新的应用程序和一个Postgres空数据库设置。 我已经安装了Heroku工具带,可以登录到Heroku并成功运行以下命令: 我在这里查看activerecord选项 但是,我运气不太好。 任何Heroku/Postgres大师能帮我指明正确的方向吗?数据库为空。作为第一步,我所要做的就是成功地连接到数据库。 Ruby文件:

  • 这是我得到的错误堆栈跟踪... 无法连接到mydb。创建到mydb的SQL模型连接连接时出错。(错误:oracle.jdbc.OracleDRiver)oracle.jdbc.OracleDRiver创建到mydb的JDBC连接时出错。(错误:oracle.jdbc.OracleDRiver)oracle.jdbc.OracleDRiver。 我正在使用oracle瘦驱动程序连接到数据库。。 SI