2 Replies Latest reply on Mar 19, 2010 4:46 AM by Michael Wohlfart

    JBPM 4.3 Spring 2.5.6 Hibernate 3.3.2 Problem

    null null Newbie
      Hello,

       

       

      Environment: Spring 2.5.6 ..JBPM 4.3, Hibernate 3.3.2

        • 1. Re: JBPM 4.3 Spring 2.5.6 Hibernate 3.3.2 Problem
          null null Newbie

          Sorry missed text:

           

           

           

          Since i upgrade JBPM from 4.0 to 4.3 in our project i got following excpetion.

           

          I only changed applicationContext to new Spring configuration style for JBPM.

           

          I tried to find out why jbpm thinks that a jbpm.hibernate.cfg.xml
          is needed even if in applicationcontext a hibernate session is defined w/o u
          sing such a file, but i failed. Can somebody explain this?

           

          Thanx in adavance....

           

          ---------------------------------------------------------------------

           

          exception

           

          Caused by: org.hibernate.HibernateException: jbpm.hibernate.cfg.xml not found
              at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
              at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1453)
              at org.hibernate.cfg.Configuration.configure(Configuration.java:1475)
              at org.jbpm.pvm.internal.wire.descriptor.HibernateConfigurationDescriptor$AddCfgResource.apply(HibernateConfigurationDescriptor.java:151)
              at org.jbpm.pvm.internal.wire.descriptor.HibernateConfigurationDescriptor.apply(HibernateConfigurationDescriptor.java:90)
              at org.jbpm.pvm.internal.wire.descriptor.HibernateConfigurationDescriptor.initialize(HibernateConfigurationDescriptor.java:76)
              at org.jbpm.pvm.internal.wire.WireContext.performInitialization(WireContext.java:533)
              at org.jbpm.pvm.internal.wire.WireContext.initialize(WireContext.java:495)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:449)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:437)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:417)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:327)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:688)
              at org.jbpm.pvm.internal.wire.descriptor.HibernateSessionFactoryDescriptor.construct(HibernateSessionFactoryDescriptor.java:57)
              at org.jbpm.pvm.internal.wire.WireContext.construct(WireContext.java:469)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:448)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:437)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:417)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:327)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:688)
              at org.jbpm.pvm.internal.env.BasicEnvironment.get(BasicEnvironment.java:139)
              at org.jbpm.pvm.internal.env.BasicEnvironment.get(BasicEnvironment.java:130)
              at org.jbpm.pvm.internal.wire.descriptor.HibernateSessionDescriptor.construct(HibernateSessionDescriptor.java:63)
              at org.jbpm.pvm.internal.wire.WireContext.construct(WireContext.java:469)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:448)
              at org.jbpm.pvm.internal.wire.WireContext.create(WireContext.java:437)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:417)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:327)
              at org.jbpm.pvm.internal.wire.WireContext.get(WireContext.java:688)
              at org.jbpm.pvm.internal.env.BasicEnvironment.get(BasicEnvironment.java:139)
              at org.jbpm.pvm.internal.env.BasicEnvironment.get(BasicEnvironment.java:130)
              at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:201)
              at org.jbpm.pvm.internal.env.EnvironmentImpl.getFromCurrent(EnvironmentImpl.java:190)
              at org.jbpm.pvm.internal.cmd.CheckDbCmd.execute(CheckDbCmd.java:44)
              at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
              at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
              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.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
              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)

           

          ----------------------
          applicationcontext.xml

           

          <?xml version="1.0" encoding="UTF-8"?>
          <beans xmlns="http://www.springframework.org/schema/beans"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
              xmlns:util="http://www.springframework.org/schema/util" xmlns:jndi="http://www.springframework.org/schema/jndi"
              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.0.xsd
          http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
          http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
          http://www.springframework.org/schema/jndi http://www.springframework.org/schema/jndi/spring-jndi-2.0.xsd
          http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">

           

              <bean id="sessionFactory"
                  class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
                  <property name="dataSource" ref="dataSourceCustom" />
                  ...
                  <property name="hibernateProperties">
                      <props>
                          <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                         
                          <prop key="hibernate.show_sql">false</prop>
                          <prop key="hibernate.hbm2ddl.auto">validate</prop>

           


                          <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider
                          </prop>
                          <prop key="hibernate.cache.provider_configuration">/ehcache.xml</prop>
                          <prop key="hibernate.cache.use_second_level_cache"> true</prop>
                          <prop key="hibernate.generate_statistics">true</prop>
                          <prop key="hibernate.cache.use_structured_entries">true</prop>

           

                          ...

           


                      </props>
                  </property>

           

           

           

                  <property name="mappingLocations">
                      <list>
                          <value>classpath:jbpm.execution.hbm.xml</value>
                          <value>classpath:jbpm.repository.hbm.xml</value>
                          <value>classpath:jbpm.task.hbm.xml</value>
                          <value>classpath:jbpm.history.hbm.xml</value>
                      </list>
                  </property>
                 
                 
              </bean>

           

              <bean id="transactionManager"
                  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                  <property name="sessionFactory" ref="sessionFactory" />
              </bean>

           

              <tx:annotation-driven transaction-manager="transactionManager" />

           


              <!--  Hibernate Template -->
              <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
                  <property name="sessionFactory" ref="sessionFactory" />
              </bean>

           


              <!--
                  ========================= Configuring JBPM4.3
                  =============================
              -->

           

           

           

              <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" />

           

          </beans>

           


          jbpm.cfg.xml

           

          --------------

           


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

           

          <jbpm-configuration spring="enabled">

           

              <process-engine-context>

           

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

           

                  <command-service>
                      <spring-transaction-interceptor />
                      <retry-interceptor />
                      <environment-interceptor />
                  </command-service>
                 
                  <hibernate-session-factory />

           

                  <script-manager default-expression-language="juel"
                      default-script-language="juel">
                      <script-language name="juel"
                          factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
                  </script-manager>

           

                  <id-generator />

           

                  <types resource="jbpm.variable.types.xml" />

           

                  <address-resolver />

           

                  <mail-template name='task-notification'>
                      <to users="${task.assignee}" />
                      <subject>${task.name}</subject>
                      <text><![CDATA[Hi ${task.assignee},
          Task "${task.name}" has been assigned to you.
          ${task.description}

           

          Sent by JBoss jBPM
          ]]></text>
                  </mail-template>

           

                  <mail-template name='task-reminder'>
                      <to users="${task.assignee}" />
                      <subject>${task.name}</subject>
                      <text><![CDATA[Hey ${task.assignee},
          Do not forget about task "${task.name}".
          ${task.description}

           

          Sent by JBoss jBPM
          ]]></text>
                  </mail-template>

           

              </process-engine-context>

           

              <transaction-context>
                  <repository-session />
                  <db-session />

           

                  <hibernate-session current="true"/>

           

                  <message-session />
                  <timer-session />
                  <history-session />
                  <mail-session>
                      <mail-server>
                          <session-properties resource="jbpm.mail.properties" />
                      </mail-server>
                  </mail-session>
              </transaction-context>

           


              <import resource="jbpm.tx.hibernate.cfg.xml" />
              <import resource="jbpm.jpdl.cfg.xml" />
              <import resource="jbpm.identity.cfg.xml" />
              <import resource="jbpm.businesscalendar.cfg.xml" />
              <import resource="jbpm.jobexecutor.cfg.xml" />

           

          </jbpm-configuration>

          • 2. Re: JBPM 4.3 Spring 2.5.6 Hibernate 3.3.2 Problem
            Michael Wohlfart Expert

            Hello null

             

            this is in the current version of jbpm.tx.hibernate.cfg.xml:

            [...]

            <hibernate-configuration>
               <cfg resource="jbpm.hibernate.cfg.xml" />    
            </hibernate-configuration>

            [...]

             

            since you do <import resource="jbpm.tx.hibernate.cfg.xml" /> in your jbpm.cfg.xml you get what you ask for ;-)

            maybe check the other includes too just to be sure...