Hibernate 查询仅在一台机器上挂起

发布于 2025-01-14 05:49:58 字数 587 浏览 4 评论 0原文

我在 Glassfish 服务器上部署了一个 Java 应用程序。在从一台 Windows 7 迁移到另一台装有 Windows 10 的电脑期间,我遇到了一个非常奇怪的问题。当我启动本地开发环境,连接到相同的数据库,使用相同版本的战争工件时,在新机器上,一切似乎都工作正常,但当我尝试访问一个功能时,它就冻结了。没有错误消息,http 请求永远不会得到答复。

我连接到 Glassfish 上的调试端口并准确地追踪到从未执行的行。这是 hibernate Query 对象 .list() 方法。它应该执行一个 SELECT。

我尝试部署工件,尝试不同的版本,确认它们正在部署,添加日志记录以确保代码停止在我认为的地方,行为没有变化。

将相同的工件复制到我的旧机器上可以正常工作。除了操作系统之外,环境之间的差异在于新机器通过 VPN 连接,而旧机器在本地网络上,但我认为这并不重要,因为显然已经建立了与数据库的连接。

环境:

  • Glassfish 2.1.1
  • Java 1.8
  • Hibernate 版本:5.4.21
  • DB:JNDI Oracle
  • JDBC 版本:19.3.0.0

I have a Java application deployed on Glassfish server. During the move from one Windows 7 to another PC with Windows 10 I have encountered a very strange problem. As I launch local dev environment, connecting to the same database, with the same versions of war artifacts, on the new machine, everything seems to be working fine, but when I try to access one function, it just freezes. No error messages, the http request is never answered.

I connected to the debug port on Glassfish and tracked down exactly the line that never executes. It's the hibernate Query object .list() method. It's supposed to execute a SELECT.

I tried deploying artefacts, tried different versions, confirmed that they ARE being deployed, added logging to make sure that the code stops where I think it does, no change in the behavior.

The same artifact, copied to my old machine works without a problem. The difference between environments, aside from OS, is the fact that new machine is connecting via VPN, while the old one is on the local network, however I don't think this could matter, as obviously the connection to DB is established.

Environment:

  • Glassfish 2.1.1
  • Java 1.8
  • Hibernate version: 5.4.21
  • DB: JNDI Oracle
  • JDBC version: 19.3.0.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2025-01-21 05:49:58

Looking at the supported operating systems for Glassfish 2.1.1, it does not list Windows 10. I would not trust the server to behave consistently on the new system and would recommend trying to run Glassfish on a supported operating system (or upgrading to a version of Glassfish that is not 13 years old)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文