Spring boot 3 - вход в консоль базы данных H2 не работаетJAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Spring boot 3 - вход в консоль базы данных H2 не работает

Сообщение Anonymous »


I worked in spring boot 2.x version without any hassles with H2 in memory database. Now, we are migrating to Spring boot 3.x version and facing issues while trying to configure and access H2 database.

Here is my project source code details and the issues, I'm facing it.

Spring boot version and h2 dependency in pom.xml

4.0.0 org.springframework.boot spring-boot-starter-parent 3.3.0-M1 com.aptimize RCAApp 0.0.1-SNAPSHOT RCAApp RCA Application 21 org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-devtools runtime true com.h2database h2 runtime org.projectlombok lombok true org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-maven-plugin org.projectlombok lombok spring-milestones Spring Milestones https://repo.spring.io/milestone false spring-milestones Spring Milestones https://repo.spring.io/milestone false Properties configured in application.properties

spring.h2.console.enabled=true spring.datasource.url=jdbc:h2:mem:rcaapp #spring.datasource.url=jdbc:h2:~/rcaapp spring.datasource.driverClassName=org.h2.Driver spring.datasource.username=sa spring.datasource.password=password spring.jpa.database-platform=org.hibernate.dialect.H2Dialect Source code of starter class.

import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @SpringBootApplication @EnableWebMvc public class RcaAppApplication { public static void main(String[] args) { SpringApplication.run(RcaAppApplication.class, args); } } Exception getting with the URL of jdbc:h2:mem:rcaapp

Database "mem:rcaapp" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-224] 90149/90149 (Help) org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "mem:rcaapp" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-224] at org.h2.message.DbException.getJdbcSQLException(DbException.java:690) at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) at org.h2.message.DbException.get(DbException.java:223) at org.h2.message.DbException.get(DbException.java:199) at org.h2.engine.Engine.throwNotFound(Engine.java:189) at org.h2.engine.Engine.openSession(Engine.java:90) at org.h2.engine.Engine.openSession(Engine.java:222) at org.h2.engine.Engine.createSession(Engine.java:201) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:125) at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:288) at org.h2.server.web.WebServer.getConnection(WebServer.java:811) at org.h2.server.web.WebApp.login(WebApp.java:1039) at org.h2.server.web.WebApp.process(WebApp.java:227) at org.h2.server.web.WebApp.processRequest(WebApp.java:177) at org.h2.server.web.JakartaWebServlet.doGet(JakartaWebServlet.java:129) at org.h2.server.web.JakartaWebServlet.doPost(JakartaWebServlet.java:166) Exception with the URL of jdbc:h2:~/rcaapp

Database "C:/Users/SubbareddyNallamachu/rcaapp" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-224] 90149/90149 (Help) org.h2.jdbc.JdbcSQLNonTransientConnectionException: Database "C:/Users/SubbareddyNallamachu/rcaapp" not found, either pre-create it or allow remote database creation (not recommended in secure environments) [90149-224] at org.h2.message.DbException.getJdbcSQLException(DbException.java:690) at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) at org.h2.message.DbException.get(DbException.java:223) at org.h2.message.DbException.get(DbException.java:199) at org.h2.engine.Engine.throwNotFound(Engine.java:189) at org.h2.engine.Engine.openSession(Engine.java:72) at org.h2.engine.Engine.openSession(Engine.java:222) at org.h2.engine.Engine.createSession(Engine.java:201) at org.h2.engine.SessionRemote.connectEmbeddedOrServer(SessionRemote.java:343) at org.h2.jdbc.JdbcConnection.(JdbcConnection.java:125) at org.h2.util.JdbcUtils.getConnection(JdbcUtils.java:288) at org.h2.server.web.WebServer.getConnection(WebServer.java:811) at org.h2.server.web.WebApp.login(WebApp.java:1039) at org.h2.server.web.WebApp.process(WebApp.java:227) at org.h2.server.web.WebApp.processRequest(WebApp.java:177) at org.h2.server.web.JakartaWebServlet.doGet(JakartaWebServlet.java:129) at org.h2.server.web.JakartaWebServlet.doPost(JakartaWebServlet.java:166)
Изображение

Изображение


I am able to access the login page of the console but not able to proceed further with these issues. I am not getting any exception in console.


Источник: https://stackoverflow.com/questions/781 ... ot-working
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»