Spring hibernate无法加载JDBC驱动程序类

时间:2016-06-22 17:23:33

标签: java spring hibernate postgresql jdbc

我不知道该怎么做。我将postgres添加到maven依赖项并且它构建成功。但是当我运行它时我得到了异常

  

引起:org.springframework.beans.PropertyBatchUpdateException;嵌套的PropertyAccessExceptions(1)是:   PropertyAccessException 1:org.springframework.beans.MethodInvocationException:Property' driverClassName'抛出异常;嵌套异常是java.lang.IllegalStateException:无法加载JDBC驱动程序类[com.postgresql.jdbc.Driver]

PLZ帮助

修改

这是我的pom

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
  <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.6</version>
    <configuration>
      <warSourceDirectory>WebContent</warSourceDirectory>
      <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
  </plugin>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.3</version>
    <configuration>
      <source>1.8</source>
      <target>1.8</target>
    </configuration>
  </plugin>
</plugins>
</build>
<dependencies>
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-core</artifactId>
    <version>5.2.0.Final</version>
</dependency>
<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.3-1100-jdbc41</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.3.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.3.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>4.3.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>4.3.0.RELEASE</version>
</dependency>

0 个答案:

没有答案