title: Hibernate IntelliJ - Unable to load class [org.postgresql.Driver]
body: <p>I want to run my own Hibernate application atop of a psql database set up in intellij:</p>
  
  <p><a href="https://i.stack.imgur.com/mRdPe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mRdPe.png" alt="As you can see, I have the recent Postgresql Driver."></a></p>
  
  <p><a href="https://jdbc.postgresql.org/documentation/93/load.html" rel="nofollow noreferrer">https://jdbc.postgresql.org/documentation/93/load.html</a>
  does not exactly explain how the xml should be configured...</p>
  
  <p>This is the Error I get:</p>
  
  <pre><code>/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home/bin/java --add-modules java.xml.bind "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=50395:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Users/selfishound/Desktop/DBPRAK/3/Testat33/out/production/Testat33:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/hibernate-commons-annotations-5.0.1.Final.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/dom4j-1.6.1.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/classmate-1.3.0.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/hibernate-jpa-2.1-api-1.0.0.Final.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/jandex-2.0.3.Final.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/antlr-2.7.7.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/jboss-logging-3.3.1.Final.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/jboss-transaction-api_1.2_spec-1.0.1.Final.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/javassist-3.22.0-GA.jar:/Users/selfishound/Desktop/DBPRAK/3/Testat33/lib/hibernate-core-5.2.16.Final.jar Main
  Sep 20, 2018 1:21:51 PM org.hibernate.Version logVersion
  INFO: HHH000412: Hibernate Core {5.2.16.Final}
  Sep 20, 2018 1:21:51 PM org.hibernate.cfg.Environment &lt;clinit&gt;
  INFO: HHH000206: hibernate.properties not found
  Sep 20, 2018 1:21:52 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager &lt;clinit&gt;
  INFO: HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  Failed to create sessionFactory object.
  Sep 20, 2018 1:21:55 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
  WARN: HHH10001002: Using Hibernate built-in connection pool (not for production use!)
  org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:271)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:691)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:726)
      at SessionFactoryClass.&lt;init&gt;(SessionFactoryClass.java:15)
      at PersonRelatedImpl.&lt;init&gt;(PersonRelatedImpl.java:16)
      at Menu.&lt;init&gt;(Menu.java:9)
      at Main.main(Main.java:4)
  Caused by: org.hibernate.boot.registry.classloading.spi.ClassLoadingException: Unable to load class [org.postgresql.Driver]
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:348)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.loadDriverIfPossible(DriverManagerConnectionProviderImpl.java:163)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildCreator(DriverManagerConnectionProviderImpl.java:119)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:103)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:75)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:242)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
      ... 17 more
  Caused by: java.lang.ClassNotFoundException: Could not load requested class : org.postgresql.Driver
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:336)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
      at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
      at java.base/java.lang.Class.forName0(Native Method)
      at java.base/java.lang.Class.forName(Class.java:375)
      at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:345)
      ... 29 more
  </code></pre>
  
  <p>What am I doing wrong here? I tried renaming the driver to  org.postgresql.Driver.jar and moving the jar to the root directory but that didnt help... It might have something to do with the configuration of IntelliJ, but this looks fine to me:<a href="https://i.stack.imgur.com/UbFiC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UbFiC.png" alt="enter image description here"></a></p>