DataSourcePool in WorkflowProcess - unsolved
Don't know how my answer was accepted because I didn't accept it
I'll give some more detail because I have RTFM as was answered (and accepted mysteriously).
This is my code for injecting the DataSourcePool Reference.
The SIADB is not found.
public class queryForSingleRow implements WorkflowProcess {
private static final Logger log = LoggerFactory.getLogger(queryForSingleRow.class);
@3214626
private DataSourcePool dsp;
@9944223
public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {
String dataSourceName = "SIADB";
Connection connection = null;
DataSource ds = null;
try {
log.info("Checking datasources");
for(Iterator<String> it = dsp.getAllJndiDataSourceNames().iterator(); it.hasNext();) {
String dsname = it.next();
log.info("Found datasource " + dsname);
}
log.info("Using DataSourcePool service lookup to get connection pool " + dataSourceName);
ds = (DataSource) dsp.getDataSource(dataSourceName);
connection = ds.getConnection();
//More code afterLog file output:
2021-05-27 13:41:21.737 INFO [com.s360g.aem.workflowcomponent.custom.queryForSingleRow] Checking datasources
2021-05-27 13:41:21.737 INFO [com.s360g.aem.workflowcomponent.custom.queryForSingleRow] Using DataSourcePool service lookup to get connection pool SIADB
2021-05-27 13:41:21.737 INFO [com.s360g.aem.workflowcomponent.custom.queryForSingleRow] Unable to find datasource SIADB.
com.day.commons.datasource.poolservice.DataSourceNotFoundException: No data source found with name 'SIADB' (after asking 0 providers)
I have this in CRX - /apps/source360/com.day.commons.datasource.jdbcpool.JdbcPoolService-SIADB

I know it's probably something simple like permissions or proper placement of the sling:OsgiConfig.
Help is appreciated.