2013-05-14 129 views
0

嘿傢伙一個問題 以下是信息無法加載Oracle驅動程序

告訴我的意見,如果需要更多信息

信息:在org.springframework.beans.factory.support銷燬單身.DefaultListableBeanFactory @ 7471dc3d:定義bean [dataSource,studentJDBCTemplate];工廠層次結構的根 線程「main」中的異常org.springframework.beans.factory.BeanCreationException:創建在類路徑資源[pack1/config.xml]中定義名稱爲'studentJDBCTemplate'的Bean時出錯:設置屬性值時出錯;嵌套異常是org.springframework.beans.PropertyBatchUpdateException;嵌套PropertyAccessExceptions(1)是: PropertyAccessException 1:org.springframework.beans.MethodInvocationException:屬性'dataSource'引發異常;嵌套的例外是java.lang.IllegalArgumentException異常:房產「數據源」需要

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd "> 
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property> 
    <property name="password" value="trg"></property> 
    <property name="url" value="jdbc:oracle:thin:@172.23.3.132:1521:TRAIN"></property> 
    <property name="username" value="trg12"></property> 
    <!-- <property name="schema" value="TRAIN"></property> --> 
</bean> 

<bean id="studentJDBCTemplate" class="pack1.StudentJDBCTemplate"> 
<property name="dataSource" ref="dataSource" /> 
</bean> 

這是使用數據庫連接,即時通訊豆...

+2

確保您的OJDBC jar包含在類路徑中 – hoaz 2013-05-14 13:33:30

+0

您需要將JDBC驅動程序JAR添加到類路徑中。 – Jesper 2013-05-14 13:33:44

+0

@hoaz感謝球員我有包括jar文件,但現在我再次得到如上所述的異常..... prev excep解決這是新的...它說數據源屬性需要,但我提到那個屬性在我的XML ... – 2013-05-15 04:46:39

回答

0

從異常好像你的類pack1.StudentJDBCTemplate沒有dataSource屬性。

您確定該類擴展了JDBCTemplate或其他具有dataSource屬性的類嗎?

相關問題