0

Not able to access H2 database console during JUnit testing. Since the database will be up and running only when the test is running, I am trying to have a breakpoint or a sleep command to hold the test execution to access http://localhost:8080/h2-console in the browser, but getting "This site can’t be reached" error.

Sleep command I am using : TimeUnit.MINUTES.sleep(2);

POM.xml

spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;Mode=PostgreSQL
spring.datasource.username=sa
spring.datasource.password=sa
hibernate.hbm2ddl.auto=create
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.jpa.hibernate.ddl-auto=none
spring.jpa.properties.hibernate.default_schema=
logging.level.root=DEBUG
hibernate.show_sql=true
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.hibernate.use-new-id-generator-mappings=true
hibernate.dialect=org.hibernate.dialect.H2Dialect
spatel
  • 1
  • 1
    Hitting a breakpoint during testing i normally am able to use the Debugger IDE (like Intellij or eclipse) to access an injected entitymanager which I can use to do querys on the database. – aschoerk Mar 16 '21 at 22:39
  • 1
    https://stackoverflow.com/a/66259759/410439 – Ravi Parekh Sep 15 '21 at 13:31

0 Answers0