OckhamsRazor
OckhamsRazor

Reputation: 4906

Flyway Unable to instantiate jdbc driver

Just starting out with Flyway and Spring 3.0. So far, all I did was add the Flyway dependency and plugin to my pom.xml. Next, I tried running mvn flyway:status in the command line. However, it complains that it is unable to instantiate the jdbc driver (I'm using postgres).

Does anybody know what might be causing this? I'm using Springsource Tool Suite to develop my app. The postgres driver is located under WEB-INF/lib/postgresql-9.1-902.jdbc4.jar

Any help is greatly appreciated! Thanks!

Upvotes: 11

Views: 20433

Answers (2)

Axel Fontaine
Axel Fontaine

Reputation: 35169

For the Maven plugin to work you must:

Add this dependency to your project (or just the plugin):

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-901-1.jdbc4</version>
</dependency>

and configure the plugin like this:

<plugin>
    <groupId>com.googlecode.flyway</groupId>
    <artifactId>flyway-maven-plugin</artifactId>
    <version>1.7</version>
    <configuration>
        <driver>org.postgresql.Driver</driver>
        <url>jdbc:postgresql://...</url>
        <user>...</user>
        <password>...</password>
    </configuration>
</plugin>

Upvotes: 23

Biju Kunjummen
Biju Kunjummen

Reputation: 49915

You also have to provide the Postgresql jdbc drivers as a maven dependency:

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-902.jdbc4</version>
</dependency>

Upvotes: 0

Related Questions