Java: No suitable driver found for jdbc:h2

According to the Oracle docs: http://docs.oracle.com/cd/E19501-01/819-3659/beadf/index.html

Classloaders delegate classloading to child classloaders, searching for the class on the classpath. However, the URLClassloader you used to load your library is not visible to the system or bootstrap hierarchy, so it can not find the class (despite it being loaded, albeit in another castl...classloader).

The easiest solution is to replace your system classloader with a URLClassloader and use addUrl(...path...) to load your library, as this answer suggests: How should I load Jars dynamically at runtime?


I had the same problem. The h2 driver was configured in the pom.xml with

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.4.193</version>
</dependency>

Because I'm using Java 6 in my project (don't ask why ;-)) but the h2-1.4.193.jar from the Maven Repository depends on Java 7, this driver version could not be used.

Changing the pom.xml to use h2-1.4.190.jar solved the problem for me.

See also issue #300 in the h2database git project.