Component is in satisfied state but not in active state in OSGI console
I a trying to connect to a Oracle DB using java code in an AEM application. For that I have configured everything in connections pool in OSGI console and I am trying to get the appropriate data soure using java code. Below are the details:
package com.pnc.main.businessddaapp.dao.datasource.impl;
import javax.sql.DataSource;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.day.commons.datasource.poolservice.DataSourceNotFoundException;
import com.day.commons.datasource.poolservice.DataSourcePool;
import com.xxx.businessddaapp.dao.datasource.BusinessDDAApplicationDataSource;
@Component(metatype = true)
@Service
public class BusinessDDAApplicationDataSourceImpl implements BusinessDDAApplicationDataSource {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
private static final String DEFAULT_BUSINESSDDA_INTEGRATION_DATASOURCE = "KIDS";
@Reference
private DataSourcePool source;
@Override
public DataSource getDataSource() {
DataSource dataSource = null;
try {
dataSource = (DataSource) source.getDataSource(DEFAULT_BUSINESSDDA_INTEGRATION_DATASOURCE);
return dataSource;
} catch (DataSourceNotFoundException e) {
logger.error("Datasource not configured/not found", e);
} catch (Exception e) {
logger.error("Exception while getting the datasource ", e);
}
return null;
}
}
But for some reason, when I check the OSGI console(http://localhost:4503/system/console/components) this class/component is in satisfied state and thus its not getting called while running the application. What changes do I need to make in order to make this component active ? Do I need to add any other configurations ?