Xml 通过从Apache Camel中的属性文件获取用户名和密码,拒绝登录Oracle 11g数据库

Xml 通过从Apache Camel中的属性文件获取用户名和密码,拒绝登录Oracle 11g数据库,xml,oracle11g,apache-camel,Xml,Oracle11g,Apache Camel,我正在尝试从.properties文件获取用户名和密码的值,并尝试登录到oracle数据库。我遵循所有指定的语法,但oracle数据库拒绝访问数据库。我正在为属性提供占位符配置和数据库bean <bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent"> <property name="location" value="classpath:DB.prope

我正在尝试从.properties文件获取用户名和密码的值,并尝试登录到oracle数据库。我遵循所有指定的语法,但oracle数据库拒绝访问数据库。我正在为属性提供占位符配置和数据库bean

<bean id="properties" class="org.apache.camel.component.properties.PropertiesComponent">
    <property name="location" value="classpath:DB.properties" />
         </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> 

虽然我遵循了所有正确的语法,但在连接到数据库时遇到了问题。请帮助解决此问题。

而不是在Camel Core jar中使用Apache Camel提供的属性bean。我使用了context:property placeholder,它清除了我的错误。除此之外,我还添加了以下xmlns和xsi:schemalocation

xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"

 xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
**http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">****

“拒绝访问”有点含糊不清——你到底会犯什么错误?为什么要连接到功能强大的系统帐户而不是自己的帐户?我得到的这个错误正是由以下原因引起的:org.springframework.beans.factory.BeanCreationException:创建名为“initDatabase”的bean时出错,该bean在文件[C:\Desktop\camel example sql\target\classes\META-INF\spring\camel context.xml]中定义:调用init方法失败;嵌套异常为org.springframework.jdbc.CannotGetJdbcConnectionException:无法获取jdbc连接;嵌套异常为org.apache.commons.dbcp.SQLNestedException:无法创建PoolableConnectionFactory ORA-01017:无效的用户名/密码;登录被拒绝。我正在使用速成版oracle 11g进行POC
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"

 xsi:schemaLocation="http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
**http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">****