问题描述
网上关于SSH框架上传下载的资料有很多,本人也下载了很多,但网上例子是用Oracle9i做的,说“用MYSQL实现一样很简单”,可在下百试不得其解,下面是我的Spring配置文件,其他的比如DAOBIZ还有表单以及action都写好了,可是每到一部署就出现错误,请大家帮忙看看,时间比较紧迫,期待正解.网上有人也处理过这个问题,我就是按照他调试成功后的方法写的配置文件,可是部署出错,主要问题应该是在我标红的地方,请看下Spring配置文件:<?xmlversion="1.0"encoding="UTF-8"?><!DOCTYPEbeansPUBLIC"-//SPRING//DTDBEAN//EN""http://www.springframework.org/dtd/spring-beans.dtd"><beans><beanid="hibernateProperties"class="org.springframework.beans.factory.config.PropertiesFactoryBean"><propertyname="properties"><props><propkey="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop><propkey="hibernate.show_sql">true</prop></props></property></bean><beanid="dataSource"class="org.apache.commons.dbcp.BasicDataSource"><propertyname="driverClassName"><value>com.mysql.jdbc.Driver</value></property><propertyname="url"><value>jdbc:mysql://localhost:3306/updown</value></property><propertyname="username"><value>root</value></property><propertyname="password"><value>mysql</value></property></bean><!--以下是:处理Blob类型的特殊声明//--><beanid="nativeJdbcExtractor"class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor"lazy-init="true"/><beanid="defaultLobHandler"class="org.springframework.jdbc.support.lob.DefaultLobHandler"lazy-init="true"><propertyname="nativeJdbcExtractor"><reflocal="nativeJdbcExtractor"/></property></bean><beanid="sessionFactory"class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"><propertyname="dataSource"><refbean="dataSource"/></property><propertyname="lobHandler"><refbean="defaultLobHandler"/></property><propertyname="hibernateProperties"><refbean="hibernateProperties"/></property><propertyname="mappingResources"><list><value>com/dhu/pintp/model/Tfile.hbm.xml</value></list></property></bean><beanid="transactionManager"class="org.springframework.orm.hibernate3.HibernateTransactionManager"><propertyname="sessionFactory"><refbean="sessionFactory"/></property></bean><!--DAO的IoC配置//--><beanid="hibernateTemplate"class="org.springframework.orm.hibernate3.HibernateTemplate"><propertyname="sessionFactory"ref="sessionFactory"/></bean><beanid="tfileDAO"class="com.dhu.pintp.daoimpl.TfileDAOImpl"><propertyname="hibernateTemplate"ref="hibernateTemplate"/></bean><!--事务处理的AOP配置//--><beanid="txProxyTemplate"abstract="true"class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"><propertyname="transactionManager"ref="transactionManager"/><propertyname="transactionAttributes"><props><propkey="get*">PROPAGATION_REQUIRED,readOnly</prop><propkey="find*">PROPAGATION_REQUIRED,readOnly</prop><propkey="save">PROPAGATION_REQUIRED</prop><propkey="write">PROPAGATION_REQUIRED,readOnly</prop></props></property></bean><beanid="fileBiz"parent="txProxyTemplate"><propertyname="target"><beanclass="com.dhu.pintp.bizimpl.FileBizImpl"><propertyname="tfileDAO"ref="tfileDAO"/></bean></property></bean></beans>部署之后控制台出现如下错误提示:严重:action:nullorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sessionFactory'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Cannotresolvereferencetobean'defaultLobHandler'whilesettingbeanproperty'defaultLobHandler';nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'defaultLobHandler'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.NotWritablePropertyException:Invalidproperty'nativeJdbcExtractor'ofbeanclass[org.springframework.jdbc.support.lob.DefaultLobHandler]:Beanproperty'nativeJdbcExtractor'isnotwritableorhasaninvalidsettermethod:Doestheparametertypeofthesettermatchthereturntypeofthegetter?org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'defaultLobHandler'definedinServletContextresource[/WEB-INF/applicationContext.xml]:Errorsettingpropertyvalues;nestedexceptionisorg.springframework.beans.NotWritablePropertyException:Invalidproperty'nativeJdbcExtractor'ofbeanclass[org.springframework.jdbc.support.lob.DefaultLobHandler]:Beanproperty'nativeJdbcExtractor'isnotwritableorhasaninvalidsettermethod:Doestheparametertypeofthesettermatchthereturntypeofthegetter?org.springframework.beans.NotWritablePropertyException:Invalidproperty'nativeJdbcExtractor'ofbeanclass[org.springframework.jdbc.support.lob.DefaultLobHandler]:Beanproperty'nativeJdbcExtractor'isnotwritableorhasaninvalidsettermethod:Doestheparametertypeofthesettermatchthereturntypeofthegetter?atorg.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:670)atorg.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:572)...............
解决方案
解决方案二:
问题已经解决,等待结贴
解决方案三:
怎么就结贴啦,还没看到解决方法呢
解决方案四:
DAO必须继承Spring的HibernateDaoSupport抽象类
解决方案五:
请教是怎么解决的啊?谢谢了!