AnsweredAssumed Answered

Extending behaviour of activiti

Question asked by jansi on Sep 2, 2016
Latest reply on Sep 9, 2016 by jansi
Hi,

I am trying to extend behaviour of Activiti in a Spring based activiti application.
So created interface extending your interface. For eg:
MyRepositoryService extends RepositoryService{}.

And also created implementation class extending your corresponding implementation class. For eg:
MyRepositoryServiceImpl extends RepositoryServiceImpl implements MyRepositoryService{}

My activiti-context file is

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:task="http://www.springframework.org/schema/task"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
   http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.2.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
   http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.2.xsd">


<context:annotation-config/>
<context:component-scan base-package="com.fingress.*">
<!–         <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
–>    </context:component-scan>

   <bean id="dataSource"
      class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
      <property name="driverClass" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://localhost:3306/fingresstest" />
      <property name="username" value="root" />
      <property name="password" value="password" />
   </bean>

   <bean id="transactionManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
      <property name="dataSource" ref="dataSource" />
   </bean>

   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseSchemaUpdate" value="true" />
      <property name="jobExecutorActivate" value="false" />
      <property name="deploymentResources"
         value="classpath*:/org/activiti/spring/test/autodeployment/autodeploy.*.bpmn20.xml" />
   </bean>

   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
      <property name="processEngineConfiguration" ref="processEngineConfiguration" />
   </bean>

   <bean id="repositoryService" factory-bean="processEngine"
      factory-method="getRepositoryService" />
   <bean id="runtimeService" factory-bean="processEngine"
      factory-method="getRuntimeService" />
   <bean id="taskService" factory-bean="processEngine"
      factory-method="getTaskService" />
   <bean id="historyService" factory-bean="processEngine"
      factory-method="getHistoryService" />
   <bean id="managementService" factory-bean="processEngine"
      factory-method="getManagementService" />
      
</beans>

But when i try to deploy a process, i am getting null pointer exception in the below line of RepositoryServiceImpl class. "commandExecutor" seems to be null

public Deployment deploy(DeploymentBuilderImpl deploymentBuilder) {
    return commandExecutor.execute(new DeployCmd<Deployment>(deploymentBuilder));
  }

Outcomes