0

I have created a @Component and in that component at instance level I am doing @Reference DataSourcePool.

But the Class DataSourcePool is not found so my class doen't compile. I am using CRXDE Eclipse. I have done all this by following this link.

http://helpx.adobe.com/experience-manager/using/datasourcepool.html

Please See my code and snap shot.

package com.videojet.hiresite.database;

import java.sql.Connection;
import java.sql.DriverManager;
import com.day.commons.datasource.poolservice.DataSourcePool;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.Service;

@Component
@Service
public class ConnectionProvider {

    @Reference
    private DataSourcePool source;

    public Connection getConnection() throws Exception
    {
        //VideojetDatasource
        Class.forName("oracle.jdbc.driver.OracleDriver");   
        return DriverManager.getConnection("jdbc:oracle:thin:@xxxxxx","xxxx","xxx");

    }

}

enter image description here

So Do I have to Add an Extra Jar in OSGi Bundle to this to work ?

Update @ Tomek Rękawek Dude When I say I'm not using Maven I mean it. I have NOT followed the whole tutorial. This is what I am using it's CRXDE Eclipse enter image description here

Oliver
  • 6,152
  • 2
  • 42
  • 75

2 Answers2

3

Add following dependency to your pom.xml:

<dependency>
    <groupId>com.day.commons</groupId>
    <artifactId>day.commons.datasource.poolservice</artifactId>
    <version>1.0.10</version>
    <scope>provided</scope>
</dependency>

In general, if you wonder which bundle contains a class, open the Felix Console, choose Main / Packages (relative path: /system/console/depfinder) and enter the full class name (like com.day.commons.datasource.poolservice.DataSourcePool). You'll get a <dependency> that you can copy & paste to your pom.xml.

Tomek Rękawek
  • 9,204
  • 2
  • 27
  • 43
  • I am not using Maven, infact I don't know how to use maven. I am using a dedicated Eclipse(CRXDE) that Adobe has provided for creating Bundles/Componenets/Templates/. It's like CRXDElite but more powerful. What should I do? Is there a link where I can download this as OSGi bundle ? – Oliver May 29 '14 at 12:11
  • The tutorial you've linked describes how to create a Maven CQ project from the archetype, so if you followed it, you are using Maven. Find the pom.xml file in your project root and add above dependency to the `` section. – Tomek Rękawek May 29 '14 at 12:59
  • Please See Update ! My Problem is I don't know anything about this super advance tool called Maven ... I just don't know how to use it.. Why did evryone all of a sudden started using Maven. I think Maven is very complex with all those difficult to remember commands. – Oliver May 29 '14 at 13:09
0

I solved it. I download the Jar from here http://repo.adobe.com/nexus/content/groups/public/com/day/commons/day.commons.datasource.poolservice/1.0.10/

And I pasted it in /apps/myproject/src/testbundle/libs folder and the dependency is resolved.

Oliver
  • 6,152
  • 2
  • 42
  • 75