【问题标题】:H2 Console throwing a error webAllowOthers in H2 databaseH2 控制台在 H2 数据库中抛出错误 webAllowOthers
【发布时间】:2017-12-05 15:21:06
【问题描述】:

当我尝试使用 heruko 加载我的 h2 控制台时,我正在使用 heruko 部署我的应用程序,它会抛出一个错误提示。

H2 控制台 抱歉,此服务器上的远程连接('webAllowOthers')已禁用。

我在 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

我做了一些谷歌并添加了 .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

请提及我做错了什么,我无法查看 h2 控制台,有人可以帮忙解决这个问题吗? .任何帮助都将不胜感激。

谢谢 柴坦尼亚

【问题讨论】:

  • 这个问题可能对你有帮助:stackoverflow.com/questions/9838041/…
  • 嗨 Josh 感谢您的快速响应,但我需要如何使用命令 java -jar h2*.jar -web -webAllowOthers -tcp -tcpAllowOthers -browser 启动我的服务器。我需要在其中添加任何内容吗?代码或属性文件
  • 对于 Spring 应用程序,在 application.properties spring.h2.console.settings.web-allow-others=true 中有以下条目

标签: java spring-boot spring-data spring-data-jpa h2


【解决方案1】:

application.properties,添加以下设置。

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

就我而言,它有效。

【讨论】:

  • 谢谢,它对我也很好
【解决方案2】:

对于那些使用 application.yml 格式的人

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

【讨论】:

    【解决方案3】:

    停止你的项目并添加到你的 application.properties

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

    然后运行 ​​main 并重新加载您的浏览器。

    【讨论】:

      猜你喜欢
      • 2019-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-12
      相关资源
      最近更新 更多