简体   繁体   English

H2 控制台在 H2 数据库中抛出错误 webAllowOthers

[英]H2 Console throwing a error webAllowOthers in H2 database

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.当我尝试使用 heruko 加载我的 h2 控制台时,我正在使用 heruko 来部署我的应用程序,但它抛出一个错误提示。

H2 Console Sorry, remote connections ('webAllowOthers') are disabled on this server. H2 控制台 抱歉,此服务器上禁用了远程连接 ('webAllowOthers')。

i am using the below settings in my application.properties file我在 application.properties 文件中使用以下设置

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

#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.请提及我做错了什么,我无法查看 h2 控制台,有人可以帮忙解决这个问题。cosole 在本地工作正常,在 heroku 中,数据库工作正常,但无法查看控制台。任何帮助将是非常可观的。

Thanks Chaitanya谢谢柴坦亚

In application.properties , add following setting.application.properties ,添加以下设置。

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

In my case, it works.就我而言,它有效。

for those who use application.yml format对于那些使用 application.yml 格式的人

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

Stop you project and add in your application.properties停止您的项目并添加您的application.properties

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

Then run main and reload your browser.然后运行 ​​main 并重新加载浏览器。

某些云服务不允许该连接,安全限制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM