Hi,
I created Java configuration file too.
<java>
package com.fingress.workflow.configuration;
import javax.sql.DataSource;
import org.activiti.engine.impl.cfg.CommandExecutorImpl;
import org.activiti.engine.impl.interceptor.CommandExecutor;
import org.activiti.spring.ProcessEngineFactoryBean;
import org.activiti.spring.SpringProcessEngineConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
import org.springframework.transaction.PlatformTransactionManager;
import com.fingress.workflow.api.FgRepositoryService;
import com.fingress.workflow.api.impl.FgRepositoryServiceImpl;
@Configuration
@ComponentScan(basePackages = {"com.fingress.workflow.*"})
public class WorkflowConfiguration {
protected Resource[] processResources() {
return new Resource[] { new ClassPathResource("processes/*.bpmn20.xml") };
}
protected String databaseUrl() {
return "jdbc:h2:tcp://localhost/~/activiti_example4";
}
@Bean
public DataSource activitiDataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/fingresstest");
dataSource.setUsername("root");
dataSource.setPassword("password");
return dataSource;
}
@Bean
public DataSource dataSource() {
return new TransactionAwareDataSourceProxy(activitiDataSource());
}
@Bean
public PlatformTransactionManager platformTransactionManager() {
return new DataSourceTransactionManager(this.dataSource());
}
@Bean
public FgRepositoryService repositoryService(){
return new FgRepositoryServiceImpl();
}
@Bean
public ProcessEngineFactoryBean processEngineFactoryBean() {
ProcessEngineFactoryBean pe = new ProcessEngineFactoryBean();
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setDataSource(this.dataSource());
processEngineConfiguration.setTransactionManager(this.platformTransactionManager());
processEngineConfiguration.setDatabaseSchemaUpdate(SpringProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
processEngineConfiguration.setRepositoryService(this.repositoryService());
Resource[] resources = processResources();
// processEngineConfiguration.setDeploymentResources(resources);
pe.setProcessEngineConfiguration(processEngineConfiguration);
return pe;
}
}
</java>
When i try to call deploy() method, it is giving null pointer exception for <b>commandexecutor</b>. This is happening only when deploy() is called from <b>MyRepositoryService</b>. When activiti repositoryservice deploy method is called it works fine.
Mu <b>MyrepositoryService extends RepositoryServiceImpl</b>