title: HikariCP is not found when running the jar
body: <p>In a project, we are using Hibernate with HikariCP and it all works fine in Eclipse. But as soon as I generate a jar file (Maven), hikaricp cannot be found anymore. I have turned this in every possible angle, but I cannot figure out what is wrong...</p>
  
  <p>persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
   version="2.0"&gt;
      &lt;persistence-unit name="starmap" transaction-type="RESOURCE_LOCAL"&gt;
          &lt;provider&gt;org.hibernate.jpa.HibernatePersistenceProvider&lt;/provider&gt;
          &lt;class&gt;net.clanwolf.c3.transfer.pojos.User&lt;/class&gt;
          &lt;class&gt;net.clanwolf.c3.transfer.pojos.RolePlayStory&lt;/class&gt;
          &lt;class&gt;net.clanwolf.c3.transfer.pojos.RolePlayCharacter&lt;/class&gt;
          &lt;class&gt;net.clanwolf.c3.transfer.pojos.RolePlayStoryVar2&lt;/class&gt;
          &lt;properties&gt;
              &lt;property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver" /&gt;
              &lt;property name="javax.persistence.jdbc.url" value="jdbc:mysql://**.**.**.**:3306/C3?useUnicode=yes&amp;amp;characterEncoding=UTF-8" /&gt;
              &lt;property name="current_session_context_class" value="thread" /&gt;
              &lt;property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" /&gt;
  
              &lt;!-- Hikari connection pool --&gt;
              &lt;property name="hibernate.hikari.dataSource.url" value="jdbc:mysql://**.**.**.**:3306/C3?useUnicode=yes&amp;amp;characterEncoding=UTF-8" /&gt;
              &lt;property name="hibernate.hikari.dataSource.user" value="**"/&gt;
              &lt;property name="hibernate.hikari.maximumPoolSize" value="100" /&gt;
              &lt;property name="hibernate.hikari.idleTimeout" value="30000" /&gt;
              &lt;property name="hibernate.hikari.dataSource.cachePrepStmts" value="true" /&gt;
              &lt;property name="hibernate.hikari.dataSource.prepStmtCacheSize" value="250" /&gt;
              &lt;property name="hibernate.hikari.dataSource.prepStmtCacheSqlLimit" value="2048" /&gt;
              &lt;property name="hibernate.hikari.dataSource.useServerPrepStmts" value="true" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      ...
  
      &lt;dependencies&gt;
          &lt;!-- Database persistence --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;mysql&lt;/groupId&gt;
              &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
              &lt;!-- &lt;version&gt;5.1.33&lt;/version&gt; --&gt;
              &lt;version&gt;6.0.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;5.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;5.1.0.Final&lt;/version&gt;
              &lt;!-- &lt;version&gt;5.0.3.Final&lt;/version&gt; --&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
              &lt;version&gt;5.1.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/com.zaxxer/HikariCP --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;com.zaxxer&lt;/groupId&gt;
              &lt;artifactId&gt;HikariCP&lt;/artifactId&gt;
              &lt;version&gt;2.6.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-hikaricp --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-hikaricp&lt;/artifactId&gt;
              &lt;version&gt;5.2.7.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          ...
  
          &lt;!-- Spring --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-orm&lt;/artifactId&gt;
              &lt;version&gt;4.2.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-context&lt;/artifactId&gt;
              &lt;version&gt;4.2.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;!--@Transactional --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework&lt;/groupId&gt;
              &lt;artifactId&gt;spring-tx&lt;/artifactId&gt;
              &lt;version&gt;4.2.2.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.security&lt;/groupId&gt;
              &lt;artifactId&gt;spring-security-config&lt;/artifactId&gt;
              &lt;version&gt;4.2.1.RELEASE&lt;/version&gt;
          &lt;/dependency&gt;
  
          ...
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.common&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-commons-annotations&lt;/artifactId&gt;
              &lt;version&gt;5.0.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate.javax.persistence&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-jpa-2.1-api&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.Final&lt;/version&gt;
          &lt;/dependency&gt;
  
          ...
  
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>If I run this in Eclipse, it is all fine:</p>
  
  <blockquote>
    <p>01:14:05,436  INFO HikariDataSource:70 - HikariPool-1 - Started.</p>
  </blockquote>
  
  <p>If I run it from the creates jar, it says:</p>
  
  <blockquote>
    <p>01:11:14,631  WARN ConnectionProviderInitiator:256 - HHH000472: Hikari
    properties were encountered, but the Hikari ConnectionProvider was not
    found on the classpath; these properties are going to be ignored.
    01:11:14,634  WARN connections:71 - HHH10001002: Using Hibernate
    built-in connection pool (not for production use!) 01:11:14,639  INFO
    connections:127 - HHH10001005: using driver [com.mysql.cj.jdbc.Driver]
    at URL
    [jdbc:mysql://212.227.253.80:3306/C3?useUnicode=yes&amp;characterEncoding=UTF-8]</p>
  </blockquote>
  
  <p>The file IS in the classpath for sure and I do not see why it would not be found.
  Any help is very much appreciated!</p>