1 Reply Latest reply on Jan 22, 2010 5:38 AM by Olivier Lecrivain

    jBPM 4.3 - Problem with SpringHelper ("cannot find SpringTransaction in current environment")

    Olivier Lecrivain Newbie

      I'm having trouble creating the processEngine bean from SpringHelper :

       

      {code:xml}<bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper">
              <property name="jbpmCfg" value="jbpm.cfg.xml"/>
      </bean>
      <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />{code}

       

      This results in the following exception when spring builds the application context :

       

      {quote}org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in class path resource [ordermanager-core-applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.tx.SpringTransaction in current environment
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:444)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:903)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:817)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
          at java.security.AccessController.doPrivileged(Native Method)
          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
          at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
          at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
          at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
          at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
          at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
          at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
          at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
          at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
          at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
          at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
          at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
          at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
          at org.apache.catalina.core.StandardService.start(StandardService.java:516)
          at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
          at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
          at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
      Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.jbpm.api.ProcessEngine org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine()] threw exception; nested exception is org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.tx.SpringTransaction in current environment
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:127)
          at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:435)
          ... 32 more
      Caused by: org.jbpm.api.JbpmException: no org.jbpm.pvm.internal.tx.SpringTransaction in current environment
          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:204)
          at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
          at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(SpringCommandCallback.java:47)
          at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
          at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:55)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
          at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
          at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
          at org.jbpm.pvm.internal.processengine.ProcessEngineImpl.checkDb(ProcessEngineImpl.java:152)
          at org.jbpm.pvm.internal.processengine.SpringProcessEngine.create(SpringProcessEngine.java:70)
          at org.jbpm.pvm.internal.cfg.ConfigurationImpl.buildProcessEngine(ConfigurationImpl.java:92)
          at org.jbpm.pvm.internal.processengine.SpringHelper.createProcessEngine(SpringHelper.java:47)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:115)
          ... 33 more{quote}

       

      My jbpm.cfg.xml :

       

      {code:xml}<?xml version="1.0" encoding="UTF-8"?>
      <jbpm-configuration>

       

          <import resource="jbpm.jpdl.cfg.xml" />
          <import resource="jbpm.identity.cfg.xml" />
          <!-- <import resource="jbpm.jobexecutor.cfg.xml" />-->

       

          <process-engine-context>
              <repository-service />
              <repository-cache />
              <execution-service />
              <history-service />
              <management-service />
              <identity-service />
              <task-service />

       

              <!-- Here we needed to change the transaction interceptor -->
              <command-service name="txRequiredCommandService">
                  <retry-interceptor />
                  <environment-interceptor />
                  <spring-transaction-interceptor useCurrent="false"/>
              </command-service>

       

              <id-generator />
              <types resource="jbpm.variable.types.xml" />
              <address-resolver />
              <business-calendar />

       

          </process-engine-context>

       

          <transaction-context>
              <repository-session />
              <db-session />
              <message-session />
              <timer-session />
              <history-session />
              <mail-session>
                  <mail-server>
                      <session-properties resource="jbpm.mail.properties" />
                  </mail-server>
              </mail-session>
              <!--
                  Need to set explicitly that we don't want jbpm to create sessions
              -->
              <hibernate-session current="true" factory="jbpmSessionFactory"/>
          </transaction-context>
      </jbpm-configuration>{code}

       

      I'have done some research and found this jira : https://jira.jboss.org/jira/browse/JBPM-2710. So I'm aware of spring integration problems in version 4.3. However my problem seems different, and I suspect a configuration problem even if I can't figure out what is wrong (my jbpm.cfg.xml worked well with jBPM 4.2 and 4.1).

       

      Any help would be appreciated.