Get DataSourcePool for use in servlet
I'm trying to get DataSourcePool instance for servlet in OSGi bundle but the standard approach doesn't work. I used to get DataSourcePool via Activator like this
public class Activator implements BundleActivator { private DataSourcePool source; public void start(BundleContext context) throws Exception { ServiceReference dspRef = context.getServiceReference(DataSourcePool.class.getName()); source = (DataSourcePool)context.getService(dspRef); } public static DataSourcePool getDataSourcePool(){ return source; } }but since I started to develop in Eclipse, this doesn't work anymore. I have this project structure in Eclipse
project-default project-default-bundle \src \main \java \cz \package \sub1 \sub2 \Activator.java \other \package \servlets \MyServlet.java project-default-components project-default-content
When I try to get the DataSourcePool in MyServlet.java, the return value from cz.package.Activator.getDataSourcePool(); is null. I also tried to use @Reference but it just gives me HTTP 403 Forbidden error after compiling and running the servlet.
Thanks for any help