(Springboot Mybatis集合H2数据库)解决ClassNotFoundException: org.h2.Driver

1、请先检查自己的maven是否确实配置了h2的相关配置、仓库是否正确下载了h2.*.jar

2、如果上述操作确认无误,请往下看(可能是由于你配置了最新版的h2)
解决方案:

pom.xml里面应该这样来描述h2

<!--H2数据库-->

             <!-- https://mvnrepository.com/artifact/com.h2database/h2 -->

            <dependency>

                  <groupId>com.h2database</groupId>

                <artifactId>h2</artifactId>

                 <version>RELEASE</version>

                 <scope>compile</scope>

            </dependency>

你的是不是如下这样的?

<!-- https://mvnrepository.com/artifact/com.h2database/h2 -->

                <dependency>

                        <groupId>com.h2database</groupId>

                        <artifactId>h2</artifactId>

                        <version>1.4.197</version>

                        <scope>test</scope>

                </dependency>

猜你喜欢

转载自blog.csdn.net/qq_35416214/article/details/106207695