A ResourcePool could not acquire a resource from its primary factory or source

For anyone that finds this question in the future. What I was doing wrong was that I was using the jtds driver and I forgot to add that in the url. So in my properties file what I should have done was:

app.url=jdbc:jtds:sqlserver://myUrl:port;databaseName=my_database

For anyone that finds this question in the future.

This can also be caused by a missing database driver.

In my case I was using the maven-shade-plugin with the minimizeJar option set. This - of course - was throwing away the jtds driver because it is not directly referenced anywhere.

This can be fixed as follows:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>1.6</version>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>shade</goal>
        </goals>
        <configuration>
          <minimizeJar>true</minimizeJar>
          <filters>
            <filter>
              <!-- Make sure jtds is included. -->
               <artifact>net.sourceforge.jtds:jtds</artifact>
               <includes>
                   <include>**</include>
               </includes>
            </filter>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/*.SF</exclude>
                <exclude>META-INF/*.DSA</exclude>
                <exclude>META-INF/*.RSA</exclude>
                <exclude>META-INF/*.sf</exclude>
                <exclude>META-INF/*.dsa</exclude>
                <exclude>META-INF/*.rsa</exclude>
              </excludes>
            </filter>
          </filters>
        </configuration>
      </execution>
    </executions>
  </plugin>