0

hey guys one more question following is the informations

tell me in comments if more info is needed

INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7471dc3d: defining beans [dataSource,studentJDBCTemplate]; root of factory hierarchy Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentJDBCTemplate' defined in class path resource [pack1/config.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required

<?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>

this is a bean that i m using for database connection ...

4

1 回答 1

0

从异常看来,您的类 pack1.StudentJDBCTemplate 没有 dataSource 属性。

您确定该类扩展了 JDBCTemplate 或其他具有 dataSource 属性的类吗?

于 2013-05-15T04:49:18.333 回答