spring2+dpcp配置出现异常:急解决

spring的applicationContext配置文件如下
[code="xml"]
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" >

<context:property-placeholder location="classpath:jdbc.properties"  />
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${driverClassName}" />
    <property name="url" value="${url}" />
    <property name="username" value="${username}" />
    <property name="password" value="${password}" />
    <!-- 连接池启动时的初始值 -->
    <property name="initialSize" value="${initialSize}" />
    <!-- 连接池最大值 -->
    <property name="maxActive" value="${maxActive}" />
    <!-- 最大空闲值,当经过一个高峰时间后,连接池可以慢慢将已经用不到的连接慢慢释放一部分,一直减少到maxIdle为止 -->
    <property name="maxIdle" value="${maxIdle}" />
    <!-- 最小空闲值,当空闲的连接数少于阀值时,连接池就会预申请去一些连接,以免洪峰时来不及 -->
    <property name="minIdle" value="${minIdle}" />
</bean>
<!-- 采用注解事务 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSourceName" ref="dataSource"></property>
</bean>
<!-- 采用@Transaction注解方式使用事务 -->
<tx:annotation-driven transaction-manager="txManager" />


[/code]

启动tomcat的时候报了异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSourceName' of bean class [org.springframework.jdbc.datasource.DataSourceTransactionManager]: Bean property 'dataSourceName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'dataSourceName' of bean class [org.springframework.jdbc.datasource.DataSourceTransactionManager]: Bean property 'dataSourceName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

...........
请求朋友帮忙,赶紧解决吧

你少加了sitemesh的相关包引用?


改成


试试

一开始以为代码中大小写不规范所致。

大ge,你清醒一下头脑 :D

[code="xml"]

class="org.springframework.orm.hibernate3.HibernateTransactionManager">



[/code]

还需配置sessionFactory,这个不用多说。

把这个包添加进去试试sitemesh-2.4.1.jar

http://www.opensymphony.com/sitemesh/download.action

没找到sitemesh的jar包