1 Reply Latest reply on Jun 24, 2009 1:52 AM by Shekhar Vemuri

    Custom IdentitySession configuration

    Johan Kumps Newbie

      Hi,

      Can somebody provide me with an example of jbpm.cfg.xml configuring a custom IdentitySession implementation. Currently I have something like this :

      <process-engine-context>
       <identity-service/>
      
       <transaction-context>
       <object class="be.mypackage.MyIdentitySession" />
       </transaction-context>
      
       </process-engine-context>


      but I keep getting this exception when running a unit test :

      org.jbpm.api.JbpmException:
       error: no element parser for tag transaction-context in category descriptor
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:169)
       at org.jbpm.pvm.internal.xml.ProblemList.getJbpmException(ProblemList.java:142)
       at org.jbpm.pvm.internal.xml.Parse.checkErrors(Parse.java:189)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.parse(JbpmConfiguration.java:165)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.setResource(JbpmConfiguration.java:137)
       at org.jbpm.pvm.internal.cfg.JbpmConfiguration.buildProcessEngine(JbpmConfiguration.java:100)
       at org.jbpm.api.Configuration.buildProcessEngine(Configuration.java:124)
       at org.jbpm.test.JbpmTestCase.initialize(JbpmTestCase.java:89)
       at org.jbpm.test.JbpmTestCase.setUp(JbpmTestCase.java:75)
       at be.mypackage.DispatchSubmissionIT.setUp(DispatchSubmissionIT.java:56)
       at junit.framework.TestCase.runBare(TestCase.java:132)
       at junit.framework.TestResult$1.protect(TestResult.java:110)
       at junit.framework.TestResult.runProtected(TestResult.java:128)
       at junit.framework.TestResult.run(TestResult.java:113)
       at junit.framework.TestCase.run(TestCase.java:124)
       at junit.framework.TestSuite.runTest(TestSuite.java:232)
       at junit.framework.TestSuite.run(TestSuite.java:227)
       at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
       at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      
      


        • 1. Re: Custom IdentitySession configuration
          Shekhar Vemuri Newbie

          Just use something on the lines of what is specified below: Of course you WILL have to tweak it to suite all your needs,

          <?xml version="1.0" encoding="UTF-8"?>
          
          <jbpm-configuration>
          
           <import resource="jbpm.jpdl.cfg.xml"/>
           <process-engine-context>
           <repository-service/>
           <repository-cache/>
           <execution-service/>
           <history-service/>
           <management-service/>
           <identity-service/>
           <task-service/>
          
           <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>
          
           <authentication/>
           <id-generator/>
           <types resource="jbpm.variable.types.xml"/>
          
           <address-resolver/>
          
           <business-calendar>
           <monday hours="9:00-12:00 and 12:30-17:00"/>
           <tuesday hours="9:00-12:00 and 12:30-17:00"/>
           <wednesday hours="9:00-12:00 and 12:30-17:00"/>
           <thursday hours="9:00-12:00 and 12:30-17:00"/>
           <friday hours="9:00-12:00 and 12:30-17:00"/>
           <holiday period="01/07/2008 - 31/08/2008"/>
           </business-calendar>
          
           <command-service>
           <retry-interceptor/>
           <environment-interceptor/>
           <spring-transaction-interceptor current="true"/>
           </command-service>
           </process-engine-context>
          
           <transaction-context>
           <repository-session/>
           <db-session/>
           <message-session/>
           <timer-session/>
           <history-session/>
           <hibernate-session current="true"/>
          
           <!-- Custom Identity implementation-->
           <object class="com.urcompany.IdentitySessionImpl"/>
           </transaction-context>
          </jbpm-configuration>
          


          If you note the config above, the transaction-context is not inside the process-context. It is a node by itself.

          So either use the config from above or change yours to something more like:
          <process-engine-context>
           <identity-service/>
          </process-engine-context>
          <transaction-context>
           <object class="be.mypackage.MyIdentitySession" />
          </transaction-context>