2
org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure HHH000342: Could not obtain connection to query metadata : Cannot load JDBC driver class 'com.postgresql.jdbc.Driver'

I'm getting this warning while starting my application, can you help me how to solve it? It's WARN, no error or exception. (it is in my maven,spring,hibernate application), i have exceptions when i want to access my database via hibernate, but i'm not sure if this is causing the problem, thanks.

Opal
  • 81,889
  • 28
  • 189
  • 210
Charlie Harper
  • 379
  • 4
  • 7
  • 21
  • Looks like the postgresql.jar is missing in your classspath. – Jens Jun 27 '14 at 21:25
  • @Jens .jar file into classpath? can you explain what exactly should i do? what jar file? – Charlie Harper Jun 27 '14 at 21:32
  • [Here](http://jdbc.postgresql.org/download.html)you can download the jar contains the postgressql Driver. How do you start your application? – Jens Jun 27 '14 at 21:35
  • This jar: http://jdbc.postgresql.org/download.html – Kevin Bowersox Jun 27 '14 at 21:35
  • it's webapp, i just run it via IDE – Charlie Harper Jun 27 '14 at 21:36
  • I'm not sure if i understood "add .jar into classpath", but i already have it i think: http://screenshot.cz/6YJM4/ (it's external library of my project) – Charlie Harper Jun 27 '14 at 21:49
  • and i tried to put the jar into WEB-INF/lib folder but the WARN keeps... – Charlie Harper Jun 27 '14 at 21:57
  • 1
    If you're using Maven, ignore the people talking about manipulating the jar directly and declare it as a dependency. – chrylis -cautiouslyoptimistic- Jun 28 '14 at 00:26
  • yes, I'm using maven, i have the dependency, but i don't know why there is the warning. – Charlie Harper Jun 28 '14 at 08:16
  • Since I cannot add an answer to your question because it was already answered elsewhere ( still not very satisfying to me ), I will add an comment: Since you are using idea and maven please check this path `project structure -> artifacts -> -> output layout tab -> WEB-INF -> lib` and check if you have there in the lib folder all the dependencies from pom.xml. I don't know why this folder wasn't being updated by Maven. Here is the location where all your jars should be ( as stated in the accepted answer). Maybe I've, like you have, missed a configuration or something – bogdan.rusu Apr 13 '15 at 21:14

1 Answers1

2

Add the dependency on the postgresql driver to your pom.xml file

<dependency>
    <groupId>org.postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>9.3-1101-jdbc41</version>
</dependency>
Kevin Bowersox
  • 93,289
  • 19
  • 159
  • 189