1 Reply Latest reply on Mar 8, 2010 10:09 AM by Ken Hoying

    [Q v4.3] Spring - Juel Integration

    Ken Hoying Newbie

      I believe that I have successfully integrated jBPM with Spring.  However, I am still having one issue.  Section 17 of the jBPM Developer's Guide, seems to indicate that Spring objects can be referenced in Juel expressions.  However, I have not been able to make this work.  I get the stack trace:

       

      Caused by: javax.el.PropertyNotFoundException: Cannot find property boNpcPaProcess
           at de.odysseus.el.util.SimpleResolver.get(SimpleResolver.java:106)
           at de.odysseus.el.util.SimpleResolver.getValue(SimpleResolver.java:126)
           at de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:69)
           at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:42)
           at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:29)
           at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:120)
           at org.jbpm.pvm.internal.script.JuelScriptEngine.evalExpr(JuelScriptEngine.java:176)
      

       

      My jbpm.cfg.xml looks as follows:

       

      <?xml version="1.0" encoding="UTF-8"?>
      
      <jbpm-configuration>
      
             <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.identity.cfg.xml" />
      
           <process-engine-context>
                <!-- Override default script manager. Wire it to read the Spring context. -->
               <script-manager default-expression-language="juel" default-script-language="juel"
                                   read-contexts="execution, environment, process-engine, spring"
                                    write-context="">
                      <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
                      <!--  Juel should be sufficient.
                           <script-language name="bsh" factory="org.jbpm.pvm.internal.script.BshScriptEngineFactory" />
                           <script-language name="groovy" factory="org.jbpm.pvm.internal.script.GroovyScriptEngineFactory" />
                      -->
               </script-manager>
           
                <business-calendar>
                    <monday         hours="8:00-17:00"/>
                      <tuesday        hours="8:00-17:00"/>
                      <wednesday      hours="8:00-17:00"/>
                      <thursday       hours="8:00-17:00"/>
                      <friday         hours="8:00-17:00"/>
                      <holiday     period="01/07/2008 - 31/08/2008"/>
               </business-calendar>
               
               
          </process-engine-context>  
        
        <!--  Web Console 
             <import resource="jbpm.console.cfg.xml" />
        -->
        
        <!-- Needed for timers and async tasks  
             <import resource="jbpm.jobexecutor.cfg.xml" />
        -->
          
      </jbpm-configuration>
      
      

       

      My Spring config is broken into several files.  However, the relevant pieces are as follows:

       

           <bean id="springHelper" class="org.jbpm.pvm.internal.processengine.SpringHelper" />
      
             <bean id="processEngine" factory-bean="springHelper" factory-method="createProcessEngine" />
      
      
           <bean id="dataSource"
                class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiName"
                     value="jdbc/ScaGlobalDataSource" />     
           </bean>
      
           <!-- Hibernate SessionFactory -->
           <bean id="sessionFactory"
                class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                <property name="dataSource" ref="dataSource" />
                
                <!-- This config is for unit tests as the jar will not exist yet.  -->
                <!-- It does not work at runtime since the files will be located in a jar and hibernate will not pick them up.  -->
                <property name="mappingLocations">
                     <value>classpath*:**/*.hbm.xml</value>
               </property>
      
                <!-- This config does not work for unit tests as the jar will not exist yet.  -->
                <!-- It does work at runtime since the files will be located in a jar.  -->
               <property name="mappingJarLocations">
                    <list>
                          <value>classpath*:**/services.jar</value>
                          <value>classpath*:**/jbpm-pvm-*.jar</value>
                     </list>
               </property>
      
                <property name="hibernateProperties">
                     <props>
                          <prop key="hibernate.dialect">
                               org.hibernate.dialect.Oracle10gDialect
                          </prop>
                          <prop key="hibernate.show_sql">false</prop>
                          <prop key="hibernate.generate_statistics">false</prop>
                     </props>
                </property>
                
                <property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
                
                <property name="eventListeners">
                     <map>
                          <entry key="merge">
                               <bean
                                    class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener" />
                          </entry>
                     </map>
                </property>
           </bean>
      
           <bean id="transactionManager"
                class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                <property name="sessionFactory" ref="sessionFactory" />
           </bean>
      
           <bean id="hibernateTemplate"
                class="org.springframework.orm.hibernate3.HibernateTemplate">
                <property name="sessionFactory">
                     <ref bean="sessionFactory" />
                </property>
           </bean>
      
             <bean id="namedParameterJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
                <constructor-arg ref="dataSource"/>
           </bean>
      
      
      
          <bean id="basePaBO" abstract="true" parent="baseBO">
              <property name="resources">
                  <ref bean="resourcePa" />
              </property>
          </bean>
      
          <bean id="baseProcessPaBO" abstract="true" parent="basePaBO">
              <property name="processEngine">
                  <ref bean="processEngine" />
              </property>
          </bean>
      
          <bean id="boNpcPaProcess" parent="baseTransactionProxy" scope="prototype">
              <property name="target">
                  <bean class="com.premierinc.sca.pa.business.NpcPriceActivationImpl" parent="baseProcessPaBO">
      
                  </bean>
              </property>
          </bean>
      
      
      

       

      I did see some examples where a "spring.cfg" string was set in the jBPM configuration.  Is this maybe needed?

       

      <string name="spring.cfg" value="applicationContext-services-pa.xml" />
      

       

      Any help would be GREATLY appreciated!

       

      Thanks in advance,

      Ken