2013-05-14 162 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属性的类吗?

相关问题