最近在配置jbpm+ssh+proxool出了一个异常,如下:java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:54)
实在没办法了,求大牛们帮忙看下配置文件:spring的配置文件:<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- dataSource采用proxool连接池,配合proxool.xml文件、web.xml文件中相应加载servlet使用 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<value>proxool.db</value>
</property>
</bean> <bean id="jbpmTypes" class="org.springframework.orm.hibernate3.TypeDefinitionBean">
     <property name="typeName" value="string_max" />
     <property name="typeClass" value="org.jbpm.db.hibernate.StringMax" />
    </bean>


<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource"></ref>
</property>
<property name="configLocations">
<list>
<value>classpath:/hibernate.cfg.xml</value>
</list>
</property>
        <property name="typeDefinitions">
        <ref bean="jbpmTypes" />
        </property>

<property name="hibernateProperties">
<props>
<prop key="hibernate.connection.provider_class">org.hibernate.connection.ProxoolConnectionProvider</prop>

<prop key="hibernate.show_sql">true</prop>
<!--指定连接的语言-->
<prop key="dialect">org.hibernate.dialect.MySQLDialect</prop>
<!--是否收集有助于性能调节的统计数据-->
<prop key="hibernate.generate_statistics">true</prop>
<!--是否自动重新连接-->
<prop key="hibernate.autoReconnect">true</prop>
<!--是否自动释放连接-->
<prop key="hibernate.connection.release_mode">auto</prop>
<!--缓存配置-->
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/ztes/part/vo/xml/TbPart.hbm.xml</value>
</list>
</property>

</bean>
<!-- spring上下文  -->     
<bean id="springContext"
class="com.ztes.common.SpringContext">
</bean>
<!-- 事务管理 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref local="sessionFactory" />
</property>
</bean>
<bean id="txProxyTemplate" abstract="true"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="save*">PROPAGATION_REQUIRED</prop>
<prop key="add*">PROPAGATION_REQUIRED</prop>
<prop key="del*">PROPAGATION_REQUIRED</prop>
<prop key="remove*">PROPAGATION_REQUIRED</prop>
<prop key="update*">PROPAGATION_REQUIRED</prop>
<prop key="modify*">PROPAGATION_REQUIRED</prop>
<prop key="*">PROPAGATION_REQUIRED</prop>

</props>
</property>
</bean>
<!-- 添加对jdbc的支持start -->
<bean id="jdbcTemplate"
class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource">
<ref bean="dataSource" />
</property>
</bean>
<!-- jbpm配置  -->
<bean id="jbpmConfiguration"
class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
<property name="sessionFactory" ref="sessionFactory" />
<property name="configuration" value="classpath:/jbpm.cfg.xml" />
<property name="createSchema" value="false" />
</bean>
<bean id="jbpmTemplate"
class="org.springmodules.workflow.jbpm31.JbpmTemplate">
<property name="jbpmConfiguration">
<ref bean="jbpmConfiguration"/>

</property>
<constructor-arg index="0" ref="jbpmConfiguration" />
</bean>
<bean id="testProcess" 
class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
  <property name="definitionLocation"
       value="classpath:/simple/processdefinition.xml" />
</bean>
<import resource="bo-context.xml" />
<import resource="action-context.xml" />
<import resource="dao-context.xml" /></beans>
proxool.xml 如下<?xml version="1.0" encoding="utf-8"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
    <proxool>
        <alias>db</alias>
        <driver-url>jdbc:mysql://localhost:3306/work_order</driver-url>
        <driver-class>com.mysql.jdbc.Driver</driver-class>
        <driver-properties>
            <property name="user" value="root" />
            <property name="password" value="root" />
            <property name="useUnicode" value="true" />
            <property name="characterEncoding" value="UTF-8" />
        </driver-properties>
        <minimum-connection-count>5</minimum-connection-count>
        <maximum-connection-count>200</maximum-connection-count>
        <maximum-active-time>100000</maximum-active-time><!-- 处理大数据量时可以提高maximum-active-time的值 -->
        <house-keeping-test-sql>select 1</house-keeping-test-sql>
        <prototype-count>20</prototype-count>
        <house-keeping-sleep-time>60000</house-keeping-sleep-time>
    </proxool>
</something-else-entirely>hibernate.cfg.xml如下:<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration><session-factory>
<property name="hibernate.connection.driver_class">
org.hibernate.connection.ProxoolConnectionProvider
</property>
<property name="hibernate.proxool.xml">proxool.xml</property>
<property name="hibernate.proxool.pool_alias">db</property>
<!--<property name="current_session_context_class">thread</property>
<property name="hibernate.proxool.existing_pool">true</property>
-->
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.cache.use_query_cache">false</property>
    <property name="hibernate.cache.use_second_level_cache">false</property> <!-- 工作流相关开始 -->
<!-- JBPM相关开始 --> <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />
<!-- hql queries used in simulation for querying historical data
uncomment if you want to use the GetSimulationInputCommand
or maybe you also want to use the queries yourself
be patient: the queries need the stddev function to be enabled in your dialect
more information on this can be found here: http://www.camunda.com/business_process_simulation_news/mysql_and_stddev.html -->
<!--
<mapping resource="org/jbpm/sim/bam/hibernate.queries.hbm.xml" />
--> <!-- graph.action mapping files -->
<mapping resource="org/jbpm/graph/action/MailAction.hbm.xml" /> <!-- graph.def mapping files --> <!-- graph.node mapping files -->
<mapping resource="org/jbpm/graph/node/StartState.hbm.xml" />
省略n多jbpmxml
<mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml" />
<!-- JBPM相关结束 --></session-factory>
</hibernate-configuration>
jbpm.cfg.xml如下
<jbpm-configuration>  <!-- 
    The default configurations can be found in org/jbpm/default.jbpm.cfg.xml 
    Those configurations can be overwritten by putting this file called 
    jbpm.cfg.xml on the root of the classpath and put in the customized values.
  -->  <jbpm-context>
    <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory">  
        <factory>    
            <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">    
                <field name="isTransactionEnabled"><false/></field>    
                <field name="isCurrentSessionEnabled"><false/></field>    
            </bean>    
        </factory>    
    </service><!--
    <service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
   .....省略了。csdn说内容太长。
  </bean>
</jbpm-configuration>我的思路是proxool实现连接数据库,然后配置到hibernate上,hibernate通过proxool连接上数据库。出现jdbc未配置这个异常让我好纠结

解决方案 »

  1.   

    <property name="configuration" value="classpath:/jbpm.cfg.xml" />
    将classpath 中的 <import resource="jbpm.tx.hibernate.cfg.xml" />
    换成spring管理事务 <import resource="jbpm.tx.spring.cfg.xml" />
      

  2.   


    <property name="configuration" value="classpath:/jbpm.cfg.xml" />
    将classpath 中的 <import resource="jbpm.tx.hibernate.cfg.xml" />
    换成spring管理事务 <import resource="jbpm.tx.spring.cfg.xml" />