cdh111007 2012-08-26 03:08
浏览 123

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>

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 这是哪个作者做的宝宝起名网站
    • ¥60 版本过低apk如何修改可以兼容新的安卓系统
    • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
    • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
    • ¥50 有数据,怎么用matlab求全要素生产率
    • ¥15 TI的insta-spin例程
    • ¥15 完成下列问题完成下列问题
    • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
    • ¥15 YoloV5 第三方库的版本对照问题
    • ¥15 请完成下列相关问题!