hibernate+spring+proxool,总是报java.lang.UnsupportedOperationException: The user must supply a JDBC con

simonqsm 2009-03-21 07:12:26
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
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"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">

<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.proxoolPool</value><!--此处为proxool.xml配置文件中的名称-->
</property>
</bean>
<!-- 配置SessionFactory -->
<bean id="sessionFactory" name="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">false</prop>
<!--
<prop key="hibernate.hbm2ddl.auto">true</prop>
-->
<prop key="hibernate.bytecode.use_reflection_optimizer">
true
</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<!-- 查询缓存的命中率不是很高,所以设置成false -->
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.connection.release_mode">
auto
</prop>
<prop key="connection.provider_class">
org.hibernate.connection.ProxoolConnectionProvider
</prop>
<prop key="hibernate.proxool.xml">proxool.xml</prop>
<prop key="hibernate.proxool.pool_alias">
proxoolPool
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/dldx/info/olts/pojo/Blank.hbm.xml</value>
</list>
</property>
</bean>
<!-- 配置事物管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<!-- 利用注解的方式进行事务管理,本项目未采用
<tx:annotation-driven transaction-manager="transactionManager"/>
-->
<!-- 配置事物的传播特性 -->

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="*" read-only="true" propagation="NOT_SUPPORTED"/>
</tx:attributes>
</tx:advice>
<!-- 哪些类的方法参与事物 -->
<aop:config>
<aop:pointcut id="allManagerMethod"
expression="execution(* com.service.*.*(..))" />
<aop:advisor pointcut-ref="allManagerMethod"
advice-ref="txAdvice" />
</aop:config>
</beans>


proxool.xml
<?xml version="1.0" encoding="UTF-8"?>
<something-else-entirely>
<proxool>
<alias>proxoolPool</alias><!--在其他位置进行引用-->
<!--proxool只能管理由自己产生的链接-->
<driver-url>
jdbc:mysql://localhost:3306/onlinetest?username=root&password=123456
</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="123456" />
</driver-properties>
<!-- proxool自动侦查各个链接状态的毫秒数,侦查到空闲的链接就马上回收,超时的销毁 -->
<house-keeping-sleep-time>90000</house-keeping-sleep-time>
<!-- 当连接忙时等候的最大请求数,超过这个请求将不再接收-->
<simultaneous-build-throttle>20</simultaneous-build-throttle>
<!-- 最少保持的空闲连接数 -->
<prototype-count>5</prototype-count>
<!--最大连接数 -->
<maximum-connection-count>100</maximum-connection-count>
<!-- 最小连接数 -->
<minimum-connection-count>10</minimum-connection-count>
<!-- 自动重连 -->
<house-keeping-test-sql>
select CURRENT_DATE
</house-keeping-test-sql>
</proxool>
</something-else-entirely>

好几天了,郁闷死了
...全文
111 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧