java.lang.ClassNotFoundException: org.postgresql.Driver

Hi!

I’m trying to connect to my postgres database, but I’m getting this error when I call Class.forName("org.postgresql.Driver");

java.lang.ClassNotFoundException: org.postgresql.Driver

I already add pom dependencies as follows:

			<dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <version>42.2.12</version>
                <scope>runtime</scope>
            </dependency>

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

I also tryied to “import” postgresql-9.4.1207.jar into the project libraries, but I still get the same error!

Can someone help me, please?

Hi,

the second dependency is the older (2011) version of the first one. Could you remove it and try to run the project again ?

Best regards,

Anastasia