Jbpm 4.2 集成Spring问题 Error creating bean with name 'processEngine'

本文介绍了解决JBPM 4.2在集成Spring时出现的问题,包括配置错误导致流程引擎无法启动的具体原因及修复步骤。通过修改jbpm配置文件,实现了正确的集成。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


使用Jbpm4.2 集成Spring 出现问题:
  
   2009-11-12 15:49:51,640 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in file [......\WEB-INF\classes\spring\applicationContext-jbpm.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.cfg.SpringConfiguration.buildProcessEngine()] threw exception; nested exception is java.lang.NullPointerException

  Caused by: java.lang.NullPointerException
 at org.jbpm.pvm.internal.cfg.ProcessEngineImpl.checkDb(ProcessEngineImpl.java:177)

 userCommandService 为null

  经调试发现,使用Spring后userCommandService 确实是null,
  配置中缺少什么东西?未知。 文档中并无特殊说明,
 4.1没有出现问题~ 
 应该是4.2的Bug

 

jBPM-4.2集成Spring的方法,请参考这里:
http://www.family168.com/jbpm4/spring-jbpm42.html

 

jBPM-4.2默认提供的与spring整合的文件存在重大问题,使用官方推荐的配置方式根本无法启动流程引擎,需要进行如下修改:

第1步:将下面的内容保存为jbpm.tx.spring42.cfg.xml:

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

<jbpm-configuration>

  <process-engine-context>
    <command-service name="txRequiredCommandService">
      <skip-interceptor />
      <retry-interceptor />
      <environment-interceptor />
      <spring-transaction-interceptor />
    </command-service>

    <command-service name="newTxRequiredCommandService">
      <retry-interceptor />
      <environment-interceptor policy="requiresNew" />
      <spring-transaction-interceptor />
    </command-service>
  </process-engine-context>

  <transaction-context>
    <transaction />
    <hibernate-session />
  </transaction-context>

</jbpm-configuration>
 

第2步:将jbpm.tx.spring42.cfg.xml放在classpath下。

第3步:修改jbpm.cfg.xml,使用jbpm.tx.spring42.cfg.xml替换默认的jbpm.tx.spring.cfg.xml:

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

<jbpm-configuration>

  <import resource="jbpm.default.cfg.xml" />
  <import resource="jbpm.businesscalendar.cfg.xml" />
  <import resource="jbpm.tx.spring42.cfg.xml" />
  <import resource="jbpm.jpdl.cfg.xml" />
  <import resource="jbpm.identity.cfg.xml" />

  <!-- Job executor is excluded for running the example test cases. -->
  <!-- To enable timers and messages in production use, this should be included. -->
  <!--
  <import resource="jbpm.jobexecutor.cfg.xml" />
  -->

  <import resource="jbpm.mail.templates.examples.xml" />

</jbpm-configuration>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值