Home > Mobile >  H2 Database console errors with Sorry, remote connections ('webAllowOthers') are disabled
H2 Database console errors with Sorry, remote connections ('webAllowOthers') are disabled

Time:07-12

I have spring boot app that uses H2 database.

If I run it on Tomcat (comes embedded with spring boot), it works fine.

However, if I deploy the war to Liberty, I get error like:

Sorry, remote connections ('webAllowOthers') are disabled on this server.

when I navigate to my h2 console.

Here is my h2 settings in application.properties file. As said, it is working just fine with embedded Tomcat, but fails with above error when I deploy on Open/Was Liberty

# H2
spring.datasource.url=jdbc:h2:mem:MYDB
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.validationQuery=SELECT 1

# HIBERNATE
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.H2Dialect
spring.jpa.properties.hibernate.jdbc.time_zone=UTC


# H2 CONSOLE
spring.h2.console.enabled=true
spring.h2.console.path=/h2

Navigating to

http://localhost:9080/myapi/v1/h2/ in browser shows:

enter image description here

CodePudding user response:

Adding to the above application.properties file following line, fixed the issue for me

spring.h2.console.settings.web-allow-others=true
  • Related