11-21-2018 02:09 AM
Hello Everyone,
I want to create custom beans in Alfresco Process Service 1.9, for that i'm following the Spring Beans | Alfresco Documentation. As per this i have create one java class which is registered as bean and having one method that called in APS service task's expression.
but i got an error while starting process :
org.activiti.engine.ActivitiException: Unknown property used in expression: ${helloWorldBean.sayHello(execution)}
...
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'helloWorldBean'
...
It will be really helpful if someone will let me know what kind of configuration is missing. Also just wanted to confirm that I've added my project's exported jar into "/alfresco/process-services-1.9.0/tomcat/webapps/activiti-app/WEB-INF/lib". Correct me if this is not the desired folder path to add the project jar file.
best regards,
Manish Luste
12-11-2018 07:10 AM
If you use JavaConfig, you must use the 'SpringProcessEngineConfiguration' and 'ProcessEngineFactoryBean' classes (creating its as beans). Here is the example:
@PropertySource({"classpath:jdbc.properties"})
@EnableTransactionManagement
@SpringBootApplication
(
scanBasePackages = {"ru.core",}
)
public class Application {
//other beans
@Bean
SpringProcessEngineConfiguration getProcessEngineConfiguration(@Qualifier("dataSourceForActiviti") DataSource dataSourceForActiviti,
@Qualifier("transactionManagerForActiviti") PlatformTransactionManager transactionManagerForActiviti) {
SpringProcessEngineConfiguration processEngineConfiguration = new SpringProcessEngineConfiguration();
processEngineConfiguration.setTransactionManager(transactionManagerForActiviti);
processEngineConfiguration
.setDataSource(dataSourceForActiviti)
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setAsyncExecutorActivate(true);
processEngineConfiguration.setDeploymentResources(new Resource[]{
new ClassPathResource("bpm/Process1.bpmn20.xml"),
new ClassPathResource("bpm/Process2.bpmn20.xml")
});
return processEngineConfiguration;
}
@Bean
ProcessEngineFactoryBean getProcessEngineFactoryBean(SpringProcessEngineConfiguration processEngineConfiguration) {
ProcessEngineFactoryBean processEngineFactoryBean = new ProcessEngineFactoryBean();
processEngineFactoryBean.setProcessEngineConfiguration(processEngineConfiguration);
return processEngineFactoryBean;
}
@Bean
RepositoryService getRepositoryService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRepositoryService();
}
@Bean
RuntimeService getRuntimeService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getRuntimeService();
}
@Bean
TaskService getTaskService(ProcessEngineFactoryBean processEngineFactoryBean) throws Exception {
return processEngineFactoryBean.getObject().getTaskService();
}
Explore our Alfresco products with the links below. Use labels to filter content by product module.