Cannot find class [org.apache.commons.dbcp2.BasicDataSource]

Ayaskant Swain July 16, 2018

I am getting Cannot find class [org.apache.commons.dbcp2.BasicDataSource] error while deploying my Confluence plugin using atlas-run command on my local system. My plugin uses apache-commons library to connect to Confluence Postgres DB. 

This error is only coming at runtime and not compile time. My plugin code compiles without any issues and i am able to get the jar file by running the atlas-package command.

My pom.xml contains the below dependencies for the DB connection.

<!-- dependencies to connect to Confluence DB -->

<dependency>

    <groupId>org.postgresql</groupId>

    <artifactId>postgresql</artifactId>

    <version>9.4-1200-jdbc41</version>

</dependency>

<dependency>

    <groupId>org.apache.commons</groupId>

    <artifactId>commons-dbcp2</artifactId>

    <version>2.4.0</version>

</dependency>

</dependencies>

 

I tired to add scope as "provided". but that also did not help.

 

My plugin-context.xml contains the below spring beaa injection definition.

<bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource">

<property name="driverClassName" value="org.postgresql.Driver"/>

<property name="url" value="jdbc:postgresql://stag-confdb-psg01.corp.com:5432/confluence"/>

<property name="username" value="test"/>

<property name="password" value="test#123"/>

</bean>

 

This class is very much there in the build path when i develop in eclipse. I am able to import this class in any of my java class file. But don't know why the atlassian container is not able to locate it while deploying.

 

Please help in fixing this.

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events