【问题标题】:Glassfish 4.1 and MariaDB troublesGlassfish 4.1 和 MariaDB 的麻烦
【发布时间】:2018-07-20 17:03:06
【问题描述】:

我正在使用 Netbeans 8.2、Glassfish 4.1 和 MariaDB 开发企业应用程序,所有这些都在 Ubuntu 18.04 上。

但是,在与 DB 建立所有连接后,Glassfish 会返回此异常:

Internal Exception: java.sql.SQLException: Unknown system variable 'OPTION'

正如我所见,SET OPTION 命令在 MySQL 5.1 中已被弃用,最终在 MySQL 5.6 中被删除。 MariaDB 在他们的 10.0 版本中做了同样的事情。 Glassfish 4.1 好像还在用这个命令。

这让我想到了两个主要的解决方案:

  • 升级 Glassfish:Glassfish 4.1.1 非常不稳定,大部分时间都无法正常工作。新版本 (5.0.x) 与 Netbeans 8.2 不兼容。
  • 降级 MariaDB:MariaDB 5.5 在 Ubuntu 18.04 中不可用(在他们的网站上似乎是 14.04 作为其最后一个正式版本)。
  • 降级 Ubuntu:我可以将我的操作系统降级到 14.04,但我希望这可能是我最后的选择。

有人可以给我一些建议吗?谢谢!

【问题讨论】:

  • 关于你的第一点:你知道Payara吗?它是 GF 的增强版,运行良好。他们停止了 4.x 线的开发,但该版本仍然可以下载。我不使用 MySQL,所以我不知道您提到的问题是否已解决,但我认为绝对值得一试,因为服务器虽然是 Glassfish,但比原来的 GF 好得多。
  • 感谢朋友,成功了。如果您想使用此评论做出答案,我会将其标记为已接受的答案:)

标签: ubuntu netbeans glassfish mariadb glassfish-4.1


【解决方案1】:

正确的做法是使用支持现代 SQL 语法的软件版本。即使这不是最简单的解决方案,它也很可能在未来得到回报。


解决此问题的另一种方法是让MariaDB MaxScale 位于您的应用程序和数据库之间,并将其配置为将SET OPTION SQL 转换为正确的SET 形式。这可以通过Regex filter 来完成,它适用于这种情况。

这是一个小型 SQL 转换服务的 MaxScale 配置,将 SET OPTION 转换为 SET

[maxscale]
threads=auto

[my-database]
type=server
address=hostname-of-my-server
port=3306
protocol=MariaDBBackend

[database-monitor]
type=monitor
module=mariadbmon
servers=my-database
user=<username used to monitor the server>
passwd=<password for the user>
monitor_interval=5000

[replace-option]
type=filter
module=regexfilter
match=SET OPTION
replace=SET

[routing-service]
type=service
router=readconnroute
servers=my-database
user=<username used to monitor the server>
passwd=<password for the user>
filters=replace-option

[routing-listener]
type=listener
service=routing-service
protocol=MariaDBClient
port=3306

【讨论】:

    【解决方案2】:

    根据我们的经验,end of the period where Oracle offered a commercially-supported version of Glassfish, thus reducing it to a pure reference implementation role 标志着 Glassfish 的可用性和稳定性显着下降,这是一种耻辱。 Payara 是基于 Glassfish 源的外部维护和最新版本,但有许多改进。尽管他们已经停止了 GF4 为非付费客户的演变,但他们仍然在做offer a downloadable version。我鼓励你测试一下,如果你喜欢 Glassfish,你会喜欢 Payara :)

    【讨论】:

      猜你喜欢
      • 2012-03-08
      • 2016-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多