各位好 如下是我的配置文件<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@10.10.124.101:1521:orcl</value>
</property>
<property name="username">
<value>cbci</value>
</property>
<property name="password">
<value>cbci</value>
</property>
<property name="maxActive">
<value>20</value>
</property>
<property name="maxIdle" value="25" />
<property name="minIdle" value="10" />
<property name="maxWait" value="3000" />
<property name="validationQuery" value="select 1 from dual" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="300" />
<property name="logAbandoned" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="3000" />
<property name="numTestsPerEvictionRun" value="10" />
<property name="minEvictableIdleTimeMillis" value="3000" />
<!--<property name="connectionProperties" value="oracle.jdbc.ReadTimeout=3000" />-->
</bean>
<!-- Transaction manager -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>

<!-- 通过JNDI加载WebLogic数据库连接池 -->
<bean id="wlDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName">
<value>${jndi.name}</value>
</property>
<property name="defaultObject" ref="dataSource"></property>
<property name="resourceRef">
<value>false</value>
</property>
<property name="jndiEnvironment">
<props>

<prop key="java.naming.provider.url">${provider.url}</prop>
<prop key="java.naming.factory.initial">${factory.initial}</prop>
</props>
</property>
</bean>
不过每次 执行数据库操作时 就会报如下错误:Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wlDataSource' defined in URL [file:E://amn_sms/config/context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'defaultObject' of bean class [org.springframework.jndi.JndiObjectFactoryBean]: Bean property 'defaultObject' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1032)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:824)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:269)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:320)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:63)
at com.neusoft.sms.module.servicelocator.ServiceLocator.<clinit>(ServiceLocator.java:40)
... 7 more
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'defaultObject' of bean class [org.springframework.jndi.JndiObjectFactoryBean]: Bean property 'defaultObject' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:567)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:469)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:626)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:653)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:642)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1023)
... 17 more我的spring版本是1.2  的  不过 同样的一个程序 也是1.2 并没有报这个问题  报的是WARRN 信息 有了解的谢谢啦 先