0

I have the following maven-dependency:

  <postgresql.version>42.2.11</postgresql.version>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${postgresql.version}</version>
    </dependency>

And try to use it by spring-xml-configuration:

 <bean id="dataSource"
      class="org.apache.tomcat.jdbc.pool.DataSource"
      p:driverClassName="org.postgresql.Driver"
      p:url="${database.url}"
      p:username="${database.user}"
      p:password="${database.password}"/>

But during deployment I receive:

java.lang.ClassNotFoundException: org.postgresql.Driver
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass
.....

SDK is 11.0.6.

I tried:

  1. Rebuild project.

  2. Invalidate Caches/Restart

  3. Maven Clean/Install. But Install failed by the reason of:

    Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project user_service: Fatal error compiling
    

Help me, please!!!! I almost a day battle with this problem

Jelly
  • 972
  • 1
  • 17
  • 40

1 Answers1

0

Got the following from https://mvnrepository.com/artifact/postgresql/postgresql/9.1-901-1.jdbc4

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.1-901-1.jdbc4</version>
</dependency>
Abra
  • 19,142
  • 7
  • 29
  • 41
  • Tried, but: Could not find artifact org.postgresql:postgresql:pom:9.1-901-1.jdbc4 in central (https://repo.maven.apache.org/maven2) – Jelly Mar 20 '20 at 16:52