I am creating an application using Springboot. I am using H2 database as a dependency of version 2.1.214. I am getting below error-
2022-07-26 17:38:24.039 INFO 5308 --- [ main] c.e.E.EmployeeApplication : Starting EmployeeApplication using Java 17.0.4 on DESKTOP-2NJA7RF with PID 5308 (E:\SpringBoot Projects\EmployeeApplication\target\classes started by HP in E:\SpringBoot Projects\EmployeeApplication)
2022-07-26 17:38:24.039 INFO 5308 --- [ main] c.e.E.EmployeeApplication : No active profile set, falling back to 1 default profile: "default"
2022-07-26 17:38:25.334 INFO 5308 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2022-07-26 17:38:25.427 INFO 5308 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 80 ms. Found 1 JPA repository interfaces.
2022-07-26 17:38:26.521 INFO 5308 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-07-26 17:38:26.536 INFO 5308 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-07-26 17:38:26.536 INFO 5308 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.65]
2022-07-26 17:38:26.724 INFO 5308 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-07-26 17:38:26.724 INFO 5308 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2566 ms
2022-07-26 17:38:26.849 INFO 5308 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-07-26 17:38:27.993 ERROR 5308 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.h2.jdbc.JdbcSQLNonTransientException: General error: "java.lang.UnsupportedOperationException" [50000-214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:554) ~[h2-2.1.214.jar:2.1.214]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:477) ~[h2-2.1.214.jar:2.1.214]
I can't understand what it means. I have searched the stack overflow about Hikaripool, but was unable to find a solution for this issue. The application.properties are-
spring.h2.console.enabled=true
spring.datasource.platform=h2
spring.datasource.url=jdbc:h2:mem:course-library-management-system;MV_STORE=false
spring.jpa.hibernate.ddl-auto=update
The pom.xml dependencies are-
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.2</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.employee</groupId>
<artifactId>EmployeeApplication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>EmployeeApplication</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.1.214</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
CodePudding user response:
You need to remove MV_STORE=FALSE
from JDBC connection URL, there is no such setting in H2 2.*.*. These versions have only MVStore-based backed.