How can I resolve "org.postgresql.Driver" not found in my bitbucket server plugin?

David Schlesinger May 16, 2017

I'm writing a bitbucket server plugin that writes to an external postgresql DB. I'm using PostgreSQL JDBC and getting the following error when calling  Class.forName("org.postgresql.Driver") :

java.lang.ClassNotFoundException: org.postgresql.Driver not found

I've tried adding the following to my pom.xml but it results in the plugin failing to install:

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>9.4.1212</version>
        </dependency>

How can I write to an external PostgreSQL DB from my plugin?

2 answers

1 accepted

0 votes
Answer accepted
Rick Ding June 7, 2017

Hi, have you solve the problem? I meet the similar question, I want to add mysql-connector-java.jar but failed...

<dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.38</version>
            <scope>compile</scope>
        </dependency>

if you solve the problem, please reply me,thanks a lot.

David Schlesinger June 8, 2017

So one way to deal with this issue is to manually load the jar you want to use at runtime. This page was helpful: http://www.kfu.com/~nsayer/Java/dyn-jdbc.html

Rick Ding June 12, 2017

Thank you very much, you help me solve the problem which trouble me for one week. I sincerely appreciate you very much.

0 votes
edwin
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 17, 2017

Try adding the jar file into 

CATALINA_HOME/lib/

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events