H2 Console throwing a error webAllowOthers in H2 database

29,636

Solution 1

In application.properties, add following setting.

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

In my case, it works.

Solution 2

for those who use application.yml format

spring:
  h2:
    console:
      enabled: true
      settings:
        web-allow-others: true

Solution 3

Stop you project and add in your application.properties

spring.h2.console.enabled=true
spring.h2.console.settings.web-allow-others=true

Then run main and reload your browser.

Share:
29,636

Related videos on Youtube

chaitanya
Author by

chaitanya

Updated on July 15, 2020

Comments

  • chaitanya
    chaitanya almost 4 years

    I am using heruko to deploy my application when i am trying to load my h2 console using heruko it is throwing an error saying.

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

    i am using the below settings in my application.properties file

    jdbc:h2:tcp://localhost/~/test
    spring.datasource.platform=h2
    spring.datasource.url=jdbc:h2:mem:Roomy;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
    spring.datasource.driverClassName=org.h2.Driver
    spring.datasource.username=sa
    spring.datasource.password=
    spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
    spring.h2.console.enabled = true 
    spring.h2.console.settings.trace=true 
    spring.h2.console.settings.web-allow-others=true
    

    I done some google and added .h2.server.properties

    #H2 Server Properties
    1=Generic H2 (Memory)|org.h2.Driver|jdbc:h2:mem:Roomy;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE|sa
    webAllowOthers=true
    tcpAllowOthers=true
    webPort=8082
    webSSL=false
    

    Please mention what i have done wrong and i am unable to view the h2 console could someone help on this.The cosole is working fine in the local and in the heroku the DB is working with no issues but unable to view the console .Any help would be greatly appreciable.

    Thanks Chaitanya

    • Josh
      Josh almost 7 years
      This question may help you: stackoverflow.com/questions/9838041/…
    • chaitanya
      chaitanya almost 7 years
      Hi Josh Thanks for the quick response but how i needto start my server using the command java -jar h2*.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser .Do i need to add anything in the code or properties file
    • Anand
      Anand almost 6 years
      For Spring Application, have below entry in your application.properties spring.h2.console.settings.web-allow-others=true
  • Arthur Silva
    Arthur Silva over 2 years
    Thanks, it worked fine for me as well