jbpm4 有谁碰到这个奇怪的问题吗?!!!

[size=x-large]no environment to get org.hibernate.Session[/size]

我的配置:
jbpm.cfg.xml

<?xml version="1.0" encoding="UTF-8"?>

<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.tx.spring.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.console.cfg.xml" />
<import resource="jbpm.jobexecutor.cfg.xml" />


<transaction-context>
    <object
        class="org.xxx.xxx.biz.impl.IdentitySessionImpl">
    </object>
</transaction-context>

<hibernate-session-factory />

Spring的配置

<?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:p="http://www.springframework.org/schema/p"
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/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:annotation-config />

<!-- 对指定的包进行组件扫描 -->
<context:component-scan base-package="org.forever.leave" />

<!-- 配置数据源,导入c3p0-0.9.1.2.jar,mysql-connector-java-5.1.7-bin.jar -->
<bean id="dataSource"
    class="com.mchange.v2.c3p0.ComboPooledDataSource"
    destroy-method="close">
    <property name="driverClass">
        <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="jdbcUrl">
        <value>jdbc:mysql://localhost:3306/jbpm4test</value>
    </property>
    <property name="user">
        <value>root</value>
    </property>
    <property name="password">
        <value>root</value>
    </property>
</bean>

<!-- 集成hibernate配置 -->
<bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="hibernateProperties" ref="hibernateProperties" />
    <property name="mappingLocations">
        <list>
            <value>
                classpath*:org/xxx/xxx/hbm/*.hbm.xml
            </value>
            <value>classpath:jbpm.repository.hbm.xml</value>
            <value>classpath:jbpm.execution.hbm.xml</value>
            <value>classpath:jbpm.history.hbm.xml</value>
            <value>classpath:jbpm.task.hbm.xml</value>
        </list>
    </property>
</bean>

<bean name="hibernateProperties"
    class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="properties">
        <props>
            <!-- 当你使用mysql的时候,jbpm使用的是org.hibernate.dialect.MySQLInnoDBDialect -->
            <prop key="hibernate.dialect">
                org.hibernate.dialect.MySQLInnoDBDialect
            </prop>
            <prop key="hibernate.show_sql">false</prop>
        </props>
    </property>
</bean>

<!-- jbpm配置 -->
<bean id="springHelper"
    class="org.jbpm.pvm.internal.processengine.SpringHelper"
    lazy-init="default" autowire="default" dependency-check="default">
    <property name="jbpmCfg">
        <value>jbpm.cfg.xml</value>
    </property>
</bean>

<bean id="processEngine" factory-bean="springHelper"
    factory-method="createProcessEngine" />
<bean id="repositoryService" factory-bean="processEngine"
    factory-method="getRepositoryService" />
<bean id="executionService" factory-bean="processEngine"
    factory-method="getExecutionService" />
<bean id="historyService" factory-bean="processEngine"
    factory-method="getHistoryService" />
<bean id="managementService" factory-bean="processEngine"
    factory-method="getManagementService" />
<bean id="identityService" factory-bean="processEngine"
    factory-method="getIdentityService" />
<bean id="taskService" factory-bean="processEngine"
    factory-method="getTaskService" />

<!-- 模板配置自己写的,不是必须的 -->
<bean id="jbpmTemplate"
    class="org.forever.leave.jbpm.JbpmTemplate">
    <property name="processEngine" ref="processEngine"></property>
</bean>

<!-- 数据层用的模板工具,不是必须的 -->
<bean id="hibernateTemplate"
    class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory" ref="sessionFactory"></property>
</bean>

<!-- 事务配置,必须 -->
<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
</bean>

<!-- 切面配置 -->
<aop:config>
    <aop:pointcut
        expression="execution(* org.xxx.xxx.biz.*.*(..))"
        id="transactionPointcut" />
    <aop:advisor advice-ref="txAdvice"
        pointcut-ref="transactionPointcut" />
    <aop:aspect></aop:aspect>
</aop:config>
<!-- 通知配置 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
    <tx:attributes>
        <tx:method name="get*" read-only="true"
            propagation="NOT_SUPPORTED" />
        <tx:method name="find*" read-only="true"
            propagation="NOT_SUPPORTED" />
        <tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
</tx:advice>

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐