Using data source
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2013 01:55 PM
I am trying to have basic setup of Activiti in web project deployed on WebSphere 7
I have "jdbc/dbsource" configured as Oracle data source and below is code for Process engine.
Data source test connection is successful.
ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
config.setDatabaseSchemaUpdate("false");
config.setJobExecutorActivate(true);
config.setDatabaseType("oracle");
config.setDataSourceJndiName("jdbc/dbsource");
ProcessEngine p = config.buildProcessEngine();
….
However after initiating, I see in log files that it is taking default h2 database.
I do not have activiti.cfg.xml (I believe it is not required as all configuration is static as above)
What i am missing? How to tell activiti to use datasource and not default h2 database.
Thanks
I have "jdbc/dbsource" configured as Oracle data source and below is code for Process engine.
Data source test connection is successful.
ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
config.setDatabaseSchemaUpdate("false");
config.setJobExecutorActivate(true);
config.setDatabaseType("oracle");
config.setDataSourceJndiName("jdbc/dbsource");
ProcessEngine p = config.buildProcessEngine();
….
However after initiating, I see in log files that it is taking default h2 database.
I do not have activiti.cfg.xml (I believe it is not required as all configuration is static as above)
What i am missing? How to tell activiti to use datasource and not default h2 database.
Thanks
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2013 02:25 AM
By setting the DataSourceJndiName, you tell activiti to use that to lookup the schema (relevant source in ProcesEngineConfigurationImpl):
It will throw a message if the JNDI-name does not resolve to a correct datasource. Are you sure you're using the ProcessEngine instance that you built yourself (and not using ProcessEngines.getDefault())?
protected void initDataSource() {
if (dataSource==null) {
if (dataSourceJndiName!=null) {
try {
dataSource = (DataSource) new InitialContext().lookup(dataSourceJndiName);
} catch (Exception e) {
throw new ActivitiException("couldn't lookup datasource from "+dataSourceJndiName+": "+e.getMessage(), e);
}
It will throw a message if the JNDI-name does not resolve to a correct datasource. Are you sure you're using the ProcessEngine instance that you built yourself (and not using ProcessEngines.getDefault())?
