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 ?
Solved! Go to Solution.
Watch the HELPX video where we step through all of the steps:
As you can see in this video - when we create the OSGi bundle using Maven and add the Database driver file - it works...
Views
Replies
Total Likes
Hi
Satisfied is a state of a bundle where all the dependencies of that bundle is reachable or available but it doesn't depict the life cycle of a bundle.
Please have a look at this excellent community article:-
Link:- http://blog.christianposta.com/osgi/understanding-how-osgi-bundles-get-resolved-part-i/
// Understanding how OSGI bundles get resolved
Old Forum post:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...
I hope this would help you.
~kautuk
Views
Replies
Total Likes
Working example of DataSourcePool with MySql is :- https://helpx.adobe.com/experience-manager/using/datasourcepool.html
You could use it as a reference.
~kautuk
Views
Replies
Total Likes
Hi,
Add @ Activate and @Deactivate methods it will become active inplace of satisfied..
Hope that helps.
Watch the HELPX video where we step through all of the steps:
As you can see in this video - when we create the OSGi bundle using Maven and add the Database driver file - it works...
Views
Replies
Total Likes
I have similar issue, OSGI component is in satisfied state but not in active while we include Java Watch service in it ,Please let me know if you have any idea
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies