1 2 Previous Next 16 Replies Latest reply on Oct 6, 2009 11:03 AM by makam

    Integration problem of jBPM 4, Spring and Hibernate


      I would like to integrate Spring and jBPM 4 (with Hibernate) but find the following problems. Can anybody help to indicate what is wrong? Or are there any working example which demonstrate how to do the integration?


      The problem is:

      Program:
      *******************************************
      import org.jbpm.pvm.internal.cfg.JbpmConfiguration;
      import org.jbpm.pvm.internal.env.Environment;
      import org.jbpm.pvm.internal.env.EnvironmentFactory;
      import org.jbpm.pvm.internal.env.PvmEnvironment;
      import org.jbpm.pvm.internal.env.SpringContext;
      import org.springframework.context.ApplicationContext;
      import org.springframework.context.support.ClassPathXmlApplicationContext;

      import Service.ProductManager;


      public class Test{

      private static ProductManager pm;

      public static void main(String args[]){
      ApplicationContext ac = new ClassPathXmlApplicationContext(new String[] {"applicationContext-test.xml"});
      EnvironmentFactory environmentFactory = (EnvironmentFactory) new PvmEnvironment(new JbpmConfiguration());
      Environment environment = environmentFactory.openEnvironment();
      environment.setContext(new SpringContext(ac));
      }

      }

      Console output:
      *******************************************
      Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.jbpm.spring.cfg.SpringConfigurationFactoryBean] for bean with name 'jbpmConfiguration' defined in class path resource [applicationContext-test.xml]; nested exception is java.lang.ClassNotFoundException: org.jbpm.spring.cfg.SpringConfigurationFactoryBean
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:522)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1174)
      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:754)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:422)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
      at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)
      at Test.main(Test.java:17)
      Caused by: java.lang.ClassNotFoundException: org.jbpm.spring.cfg.SpringConfigurationFactoryBean
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      at org.springframework.util.ClassUtils.forName(ClassUtils.java:249)
      at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:381)
      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1135)
      ... 9 more


      This is my applicationContent.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: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/tx
      http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
      http://www.springframework.org/schema/aop
      http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">













      classpath:hibernate.cfg.xml


















      <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
      <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
      <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />



      *******************************************



      Looking forward for your reply.

        • 1. Re: Integration problem of jBPM 4, Spring and Hibernate

          Sorry for the format problem in the XML. Here I attach again.


          <?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: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/tx
           http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
           http://www.springframework.org/schema/aop
           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
          
           <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
           <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
           <property name="url" value="jdbc:mysql://localhost:3306/ig_loading"/>
           <property name="username" value="root"/>
           <property name="password" value="admin123"/>
           </bean>
          
           <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
           <property name="dataSource">
           <ref bean="dataSource"/>
           </property>
           <property name="configLocation">
           <value>classpath:hibernate.cfg.xml</value>
           </property>
           </bean>
          
           <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
           <property name="sessionFactory" ref="sessionFactory"/>
           </bean>
          
           <bean id="dbDAO" class="Dao.ProductDAO">
           <property name="sessionFactory" ref="sessionFactory"/>
           </bean>
          
           <bean id="productManager" class="Service.ProductManager">
           <property name="productDAO" ref="dbDAO"/>
           </bean>
          
           <bean id="jbpmConfiguration" class="org.jbpm.spring.cfg.SpringConfigurationFactoryBean">
           <property name="jbpmConfigurationLocation" value="jbpm.cfg.xml" />
           </bean>
           <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
           <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
           <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
          
          </beans>


          • 2. Re: Integration problem of jBPM 4, Spring and Hibernate
            shekharv

            It says there is a ClassNotFoundException. How are you adding jbpm to the classpath? Are you sure it is there?

            • 3. Re: Integration problem of jBPM 4, Spring and Hibernate
              shekharv

              OK, looked closer, try this:

              <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
               <constructor-arg value="taskengine.jbpm.cfg.xml"/>
               </bean>
              


              • 4. Re: Integration problem of jBPM 4, Spring and Hibernate
                shekharv

                or this:

                <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
                 <constructor-arg value="jbpm.cfg.xml"/>
                 </bean>
                


                • 5. Re: Integration problem of jBPM 4, Spring and Hibernate

                  Thank you for your help! However, other problems come out......

                  Do you have any working example or tutorial recommended to me? I want to learn how to integrate JBPM4, Spring and Hibernate. However, I cannot find any example which can guide me through the whole process.

                  Now I am facing this problem:
                  How to call Spring beans from a JBPM4 process? Should I create an 'environment' variable to access Spring bean?

                  The following is my code:

                  import org.jbpm.api.Configuration;
                  import org.jbpm.api.ExecutionService;
                  import org.jbpm.api.HistoryService;
                  import org.jbpm.api.ManagementService;
                  import org.jbpm.api.NewDeployment;
                  import org.jbpm.api.ProcessEngine;
                  import org.jbpm.api.ProcessInstance;
                  import org.jbpm.api.RepositoryService;
                  import org.jbpm.api.TaskService;
                  import org.jbpm.pvm.internal.env.EnvironmentFactory;
                  import org.jbpm.pvm.internal.env.SpringContext;
                  import org.springframework.beans.BeansException;
                  import org.springframework.context.ApplicationContext;
                  import org.springframework.context.ApplicationContextAware;
                  import org.springframework.context.support.ClassPathXmlApplicationContext;
                  import org.springframework.stereotype.Controller;
                  
                  import POJO.Product;
                  import Service.ProductManager;
                  @Controller
                  public class Test implements ApplicationContextAware{
                  
                   private ProductManager managerProduct;
                   private static ApplicationContext ac =null;
                  
                   public static void main(String args[]){
                   ac = new ClassPathXmlApplicationContext(new String[] {"applicationContext-test.xml"});
                   Test test = new Test();
                   test.startUpJBPM();
                   //EnvironmentFactory environmentFactory = new PvmEnvironmentFactory("environment.cfg.xml");
                   environment.setContext(new SpringContext(ac)); <=== Not sure how to create and use 'environment'
                   }
                  
                   public void startUpJBPM(){
                   ProcessEngine processEngine = new Configuration().buildProcessEngine();
                   RepositoryService repositoryService = processEngine.getRepositoryService();
                   ExecutionService executionService = processEngine.getExecutionService();
                   TaskService taskService = processEngine.getTaskService();
                   HistoryService historyService = processEngine.getHistoryService();
                   ManagementService managementService = processEngine.getManagementService();
                   NewDeployment nd = repositoryService.createDeployment();
                   nd.addResourceFromClasspath("jpdl/process.jpdl.xml").deploy();
                   ProcessInstance processInstance = executionService.startProcessInstanceByKey("process");
                   }
                  
                   public void createProduct(){
                   System.out.println("==== createProduct===");
                   managerProduct= (ProductManager) ac.getBean("productManager");
                   Product p = new Product();
                   p.setSku("04081528");
                   p.setQuantity(04);
                   p.setSupplierCode("04081528");
                   p.setIsMain(0);
                   managerProduct.addProduct(p);
                   }
                   public ProductManager getManagerProduct() {
                   return managerProduct;
                   }
                  
                   public void setManagerProduct(ProductManager managerProduct) {
                   this.managerProduct = managerProduct;
                   }
                  
                   public void setApplicationContext(ApplicationContext ac)throws BeansException {
                   this.ac=ac;
                   }
                  
                  
                  }
                  


                  Please help to indicate what is wrong.

                  • 6. Re: Integration problem of jBPM 4, Spring and Hibernate

                     

                    "KeithWong123" wrote:

                    Do you have any working example or tutorial recommended to me? I want to learn how to integrate JBPM4, Spring and Hibernate. However, I cannot find any example which can guide me through the whole process.

                    Now I am facing this problem:

                    The jbpm and spring integration is well documented in the jBPM Developer Guide now, check it out first. http://docs.jboss.com/jbpm/v4.0/devguide/html_single/#springIntegration

                    To access spring bean in jbpm scope, I think you could try the code below:
                    Environment env = Environment.getCurrent();
                    SpringContext sc = env.get(SpringContext.class);
                    sc.get("your spring bean name");
                    


                    • 7. Re: Integration problem of jBPM 4, Spring and Hibernate

                      another tip, you can find a demo about spring jbpm4 integration on Andries Inze's blog post:
                      http://www.inze.be/andries/2009/05/16/demo-on-spring-integration-with-jbpm4/

                      • 8. Re: Integration problem of jBPM 4, Spring and Hibernate
                        kukeltje

                        @Rogerofyan

                        Thanks for pointing this out, like others before you did (in other posts)

                        Makes you wonder if it really is difficult to do something like this in google: http://www.google.nl/search?q=spring+jbpm+4+integration. Results in 10 hits of which 5 are certainly relevant.

                        • 9. Re: Integration problem of jBPM 4, Spring and Hibernate

                          I follow exactly as JBPM Developers Guide session "16.3 Usage" to setup related XML. However, still cannot find the Spring Bean (my case is "TestCon" ).

                          The following are the XML and result.

                          ***process.jpdl.xml(JBPM flow definition)***

                          <?xml version="1.0" encoding="UTF-8"?>
                          
                          <process name="process" xmlns="http://jbpm.org/4.0/jpdl">
                          
                           <start g="29,189,48,48" name="start">
                           <transition g="-74,-18" name="to doSomeThing" to="doSomeThing"/>
                           </start>
                          
                           <java expr="#{TestCon}" method="createProduct" name="doSomeThing" g="178,89,80,40">
                           <transition to="printSomeThing"/>
                           </java>
                          
                           <state g="383,196,111,52" name="printSomeThing">
                           <transition g="-23,-20" name="to end" to="end"/>
                           </state>
                          
                           <end g="563,199,48,48" name="end"/>
                          
                          </process>
                          
                          


                          ******ApplicationContent-test.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: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/tx
                           http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
                           http://www.springframework.org/schema/aop
                           http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
                          
                           <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
                           <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
                           <property name="url" value="jdbc:mysql://localhost:3306/ig_loading"/>
                           <property name="username" value="root"/>
                           <property name="password" value="admin123"/>
                           </bean>
                          
                           <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
                           <property name="dataSource">
                           <ref bean="dataSource"/>
                           </property>
                           <property name="configLocation">
                           <value>classpath:hibernate.cfg.xml</value>
                           </property>
                           </bean>
                          
                           <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
                           <property name="sessionFactory" ref="sessionFactory"/>
                           </bean>
                          
                           <bean id="dbDAO" class="Dao.ProductDAO">
                           <property name="sessionFactory" ref="sessionFactory"/>
                           </bean>
                          
                           <bean id="productMan" class="Service.ProductManager">
                           <property name="productDAO" ref="dbDAO"/>
                           </bean>
                          
                           <bean id="TestCont" class="Test">
                           <property name="managerProduct" ref="productMan"/>
                           </bean>
                          
                           <bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
                           <constructor-arg value="jbpm.cfg.xml" />
                           </bean>
                          
                           <bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine" />
                           <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
                           <bean id="executionService" factory-bean="processEngine" factory-method="getExecutionService" />
                          
                          </beans>
                          


                          *****Testing programe ****

                          import org.jbpm.api.Configuration;
                          import org.jbpm.api.ExecutionService;
                          import org.jbpm.api.HistoryService;
                          import org.jbpm.api.ManagementService;
                          import org.jbpm.api.NewDeployment;
                          import org.jbpm.api.ProcessEngine;
                          import org.jbpm.api.ProcessInstance;
                          import org.jbpm.api.RepositoryService;
                          import org.jbpm.api.TaskService;
                          import org.jbpm.pvm.internal.env.Environment;
                          import org.jbpm.pvm.internal.env.SpringContext;
                          import org.springframework.beans.BeansException;
                          import org.springframework.context.ApplicationContext;
                          import org.springframework.context.support.ClassPathXmlApplicationContext;
                          import org.springframework.stereotype.Controller;
                          
                          import POJO.Product;
                          import Service.ProductManager;
                          @Controller
                          public class Test{
                           //implements ApplicationContextAware
                           private ProductManager managerProduct;
                           private static ApplicationContext ac =null;
                          
                           public static void main(String args[]){
                           ac = new ClassPathXmlApplicationContext(new String[] {"applicationContext-test.xml"});
                           Test test = new Test();
                           test.startUpJBPM();
                           }
                          
                           public void startUpJBPM(){
                           ProcessEngine processEngine = new Configuration().buildProcessEngine();
                           RepositoryService repositoryService = processEngine.getRepositoryService();
                           ExecutionService executionService = processEngine.getExecutionService();
                           TaskService taskService = processEngine.getTaskService();
                           HistoryService historyService = processEngine.getHistoryService();
                           ManagementService managementService = processEngine.getManagementService();
                           NewDeployment nd = repositoryService.createDeployment();
                           nd.addResourceFromClasspath("jpdl/process.jpdl.xml").deploy();
                           ProcessInstance processInstance = executionService.startProcessInstanceByKey("process");
                           }
                          
                           public void createProduct(){
                           System.out.println("==== createProduct===");
                           managerProduct= (ProductManager) ac.getBean("productMan");
                           Product p = new Product();
                           p.setSku("0605");
                           p.setQuantity(04);
                           p.setSupplierCode("0605");
                           p.setIsMain(0);
                           managerProduct.addProduct(p);
                           }
                           public ProductManager getManagerProduct() {
                           return managerProduct;
                           }
                          
                           public void setManagerProduct(ProductManager managerProduct) {
                           this.managerProduct = managerProduct;
                           }
                          
                          }
                          


                          **** running result ****
                          19:21:31,046 INFO SettingsFactory:296 - Default entity-mode: pojo
                          19:21:31,046 INFO SessionFactoryImpl:161 - building session factory
                          19:21:31,531 INFO SessionFactoryObjectFactory:82 - Not binding factory to JNDI, no JNDI name configured
                          19:21:34,343 INFO DefaultCommandService:52 - exception while executing command org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@181c4eb
                          org.jbpm.api.JbpmException: script evaluation error: Cannot find property TestCon
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:118)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:106)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluateExpression(ScriptManager.java:78)
                           at org.jbpm.jpdl.internal.activity.JavaActivity.perform(JavaActivity.java:68)
                           at org.jbpm.jpdl.internal.activity.JpdlAutomaticActivity.execute(JpdlAutomaticActivity.java:15)
                           at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
                           at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:64)
                           at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:37)
                           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.execute(EnvironmentInterceptor.java:54)
                           at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                           at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
                           at Test.startUpJBPM(Test.java:40)
                           at Test.main(Test.java:28)
                          Caused by: javax.script.ScriptException: Cannot find property TestCon
                           at org.jbpm.pvm.internal.script.JuelScriptEngine.evalExpr(JuelScriptEngine.java:180)
                           at org.jbpm.pvm.internal.script.JuelScriptEngine.eval(JuelScriptEngine.java:64)
                           at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:84)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:114)
                           ... 17 more
                          Caused by: javax.el.PropertyNotFoundException: Cannot find property TestCon
                           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)
                           ... 20 more
                          Exception in thread "main" org.jbpm.api.JbpmException: script evaluation error: Cannot find property TestCon
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:118)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:106)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluateExpression(ScriptManager.java:78)
                           at org.jbpm.jpdl.internal.activity.JavaActivity.perform(JavaActivity.java:68)
                           at org.jbpm.jpdl.internal.activity.JpdlAutomaticActivity.execute(JpdlAutomaticActivity.java:15)
                           at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
                           at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
                           at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:64)
                           at org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:37)
                           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.execute(EnvironmentInterceptor.java:54)
                           at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
                           at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
                           at Test.startUpJBPM(Test.java:40)
                           at Test.main(Test.java:28)
                          Caused by: javax.script.ScriptException: Cannot find property TestCon
                           at org.jbpm.pvm.internal.script.JuelScriptEngine.evalExpr(JuelScriptEngine.java:180)
                           at org.jbpm.pvm.internal.script.JuelScriptEngine.eval(JuelScriptEngine.java:64)
                           at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:84)
                           at org.jbpm.pvm.internal.script.ScriptManager.evaluate(ScriptManager.java:114)
                           ... 17 more
                          Caused by: javax.el.PropertyNotFoundException: Cannot find property TestCon
                           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)
                           ... 20 more
                          


                          Thanks again for your help.


                          • 10. Re: Integration problem of jBPM 4, Spring and Hibernate
                            shekharv

                            You would have to post your jbpm configuration too please,

                            • 11. Re: Integration problem of jBPM 4, Spring and Hibernate

                               

                              "shekharv" wrote:
                              You would have to post your jbpm configuration too please,


                              ***jbpm.cfg.xml***

                              <jbpm-configuration>
                              
                               <!--
                               The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
                               Those configurations can be overwritten by putting this file called
                               jbpm.cfg.xml on the root of the classpath and put in the customized values.
                               -->
                               <import resource="jbpm.default.cfg.xml" />
                               <import resource="jbpm.tx.hibernate.cfg.xml" />
                               <import resource="jbpm.jpdl.cfg.xml" />
                               <import resource="jbpm.identity.cfg.xml" />
                              
                               <process-engine-context>
                               <repository-service />
                               <repository-cache />
                               <execution-service />
                               <history-service />
                               <management-service />
                               <task-service />
                               <identity-service />
                               <command-service>
                               <retry-interceptor />
                               <environment-interceptor />
                               <spring-transaction-interceptor current="true" />
                               </command-service>
                              
                               <script-manager default-expression-language="juel"
                               default-script-language="juel"
                               read-contexts="execution, environment, process-engine"
                               write-context="">
                               <script-language name="juel" factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
                               </script-manager>
                              
                               </process-engine-context>
                               <transaction-context>
                               <transaction />
                               <repository-session />
                               <message-session />
                               <timer-session />
                               <history-session />
                               <hibernate-session current="true"/>
                               <identity-session />
                               </transaction-context>
                              </jbpm-configuration>
                              



                              • 12. Re: Integration problem of jBPM 4, Spring and Hibernate
                                shiyeling

                                Try add spring to the read context of script manager

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


                                • 13. Re: Integration problem of jBPM 4, Spring and Hibernate

                                  The method startUpJBPM() is totally unnecessary, since the processEngine and services should have been built by SpringConfiguration bean.

                                  To deploy your process, you could get the repositoryService from spring context:

                                  RepositoryService repositoryService = ac.getBean("repositoryService");
                                  repositoryService.createDeployment().addResourceFromClasspath("jpdl/process.jpdl.xml").deploy();
                                  



                                  • 14. Re: Integration problem of jBPM 4, Spring and Hibernate

                                     

                                    "shiyeling" wrote:
                                    Try add spring to the read context of script manager
                                     <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" />
                                     </script-manager>
                                    


                                    It was the same result that cannot find property TestCon. Do you have any sugguestion? Besides, I don't understand the meaning and possible values of the parameters of read-contexts. Are there any documents and suggested reading for this?

                                    1 2 Previous Next