使用Spring+iBatis开发,测试是发生如下异常,百思不得其解啊!求高人指点
以下是我的代码
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!-- lob字段配置 -->
<bean id="nativeJdbcExtractor" lazy-init="true"
class="org.springframework.jdbc.support.nativejdbc.CommonsDbcpNativeJdbcExtractor" />
<!-- class="org.springframework.jdbc.support.nativejdbc.WebSphereNativeJdbcExtractor" /> -->
<bean id="lobHandler" lazy-init="true"
class="org.springframework.jdbc.support.lob.OracleLobHandler">
<property name="nativeJdbcExtractor">
<ref bean="nativeJdbcExtractor" />
</property>
</bean>
<!-- 加载系统数据源配置文件 -->
<!--
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver
</value>
</property>
<property name="url">
<value>proxool.cloud</value>
</property>
</bean>
-->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="jdbc.properties" />
<property name="fileEncoding" value="UTF-8" />
</bean>
<bean id="dataSource" class="org.logicalcobwebs.proxool.ProxoolDataSource">
<!--
<property name="driver">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="driverUrl">
<value>jdbc:mysql://localhost/mytest?characterEncoding=utf-8</value>
</property>
-->
<property name="driver">
<value>${jdbc.driver}</value>
</property>
<property name="driverUrl">
<value>${jdbc.url}</value>
</property>
<property name="user">
<value>${jdbc.username}</value>
</property>
<property name="password">
<value>${jdbc.password}</value>
</property>
<!--
<property name="user">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
-->
<property name="alias">
<value>wstudy</value>
</property>
<property name="houseKeepingSleepTime">
<value>60000</value>
</property>
<property name="prototypeCount">
<value>5</value>
</property>
<property name="simultaneousBuildThrottle">
<value>20</value>
</property>
<property name="maximumActiveTime">
<value>60000</value>
</property>
<property name="houseKeepingTestSql">
<value>select CURRENT_DATE</value>
</property>
<property name="maximumConnectionCount">
<value>10</value>
</property>
<property name="minimumConnectionCount">
<value>1</value>
</property>
<property name="trace">
<value>true</value>
</property>
<property name="verbose">
<value>true</value>
</property>
</bean>
<!-- *************************************************************************** -->
<!-- 事务管理 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
</bean>
<!-- 事务通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="find*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="add*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="delete*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="modify*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="save*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="insert*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="update*" propagation="REQUIRED" timeout="60" rollback-for="Exception"/>
<tx:method name="*" read-only="true" timeout="60"/>
</tx:attributes>
</tx:advice>
<!-- WEB-INF/classes/ -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocations" value="sql-map-config.xml" />
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient">
<ref bean="sqlMapClient" />
</property>
</bean>
<bean id="baseDao" class="com.wstudy.core.dao.BaseDaoImpl">
<property name="sqlMapClientTemplate">
<ref bean="sqlMapClientTemplate" />
</property>
</bean>
<!--将上面的模版类织入到我们的DAO对象中 -->
<bean id="studentDao" class="test.ibatis.StudentDao">
<property name="sqlMapClientTemplate">
<ref bean="sqlMapClientTemplate" />
</property>
</bean>
<bean id="stDao" class="com.wstudy.dao.impl.StudentDaoImpl" parent="baseDao" scope="prototype">
</bean>
<!--
<bean id="dbtest" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref local="dataSource" />
</property>
</bean>
-->
<!-- 小柴的beans开始 -->
<!-- 导入其他配置模块 -->
<import resource="com/wstudy/questions/service/Question.xml" />
<!-- 导入其他配置模块 -->
<import resource="com/wstudy/service/teacher/teacher.xml" />
sql-map-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://www.ibatis.com/dtd/sql-map-config-2.dtd">
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
errorTracingEnabled="true"
maxRequests="50"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="true"
/>
<!--
<sqlMap resource="com/wstudy/test/AdminUserEntity.xml" />
-->
<sqlMap resource="com/wstudy/entity/teacher/TeacherEntity.xml" />
<sqlMap resource="com/wstudy/entity/teacher/EvaluationEntity.xml" />
<sqlMap resource="com/wstudy/entity/teacher/TeacherStarEntity.xml" />
<sqlMap resource="com/wstudy/entity/teacher/QueAnsEntity.xml" />
<sqlMap resource="com/wstudy/entity/teacher/EvaTeacherEntity.xml" />
<sqlMap resource="com/wstudy/core/entity/StudentEntity.xml" />
<sqlMap resource="test/ibatis/Student.xml" />
<sqlMap resource="com/wstudy/questions/entity/ComQuesAnsEntity.xml" />
<sqlMap resource="com/wstudy/questions/entity/ComQuesEntity.xml" />
<sqlMap resource="com/wstudy/questions/entity/TypicalQuesEntity.xml" />
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。