Glassfish - 从 32 位操作系统到 64 位操作系统的 Java EE 应用程序,数据库查询不完整?
从 32 位系统迁移到 64 位系统时,我面临着非常非常奇怪的问题。 我有 2 个环境:
- 开发 - Windows XP 32 位
- 生产 - Windows 2008 server R2 64 位
在两个系统上,我都使用 jdk7u1 32 位、Glassfish 3.1.1 Web Profile 和默认 JPA (eclipselink)。 在生产中,我有 Oracle Database 11g 版本 11.2.0.1.0 32 位。在 Glassfish 中,我使用 Oracle 中的适当驱动程序 (ojdbc6.jar)。 我还有 Java EE 应用程序,它从数据库视图加载产品列表并将其显示给用户,没什么特别的。
当我将应用程序部署到开发计算机并连接到生产数据库时,一切正常,我可以看到所有记录。 但是当我部署到生产环境时,命名查询仅返回很少的记录。没有错误、警告等。 应用程序的行为就像不再有记录一样,但事实并非如此。 两台机器上的连接属性完全相同。 当我从两台计算机连接 SQL Developer 时,我可以看到所有记录。
我完全不知道发生了什么事。唯一的区别是操作系统,但这不会产生问题,因为 JDK 是相同的。我说得对吗?
I'm facing very, very strange problem migrating from 32 to 64 bit system.
I have 2 envirnoments:
- Development - Windows XP 32bit
- Production - Windows 2008 server R2
64bit
On both system I use jdk7u1 32bit, Glassfish 3.1.1 Web Profile with default JPA (eclipselink).
At production I have Oracle Database 11g Release 11.2.0.1.0 32bit. In Glassfish I use appropriate driver from Oracle (ojdbc6.jar).
I also have Java EE app, which loads list of products from database view and shows it to user, nothing special.
When I deploy app to development computer and connect to production database everything is OK, I can see all records.
BUT when I deploy to production envirnoment named query returns only few records. There are no errors, warnings etc.
Application behaves like there would be no more records, but it's not true.
On both machines connection properties are exactly the same.
When I connect with SQL Developer from both computers I can see all records.
I have completely no idea what's going on. The only difference is OS, but this shouldn't make problems, since JDK is the same. Am I right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许你有缓存问题。我记得 Toplink(EclipseLink 的基础)默认有缓存机制ON。因此,如果是这种情况:
机器 A
创建/修改了记录,这些修改不会反映在机器 B
中,因为它们没有更新其缓存。Machine A
或Machine B
的 EclipeLink 中更新。您可以验证它是否直接在数据库上更改记录并验证它是否反映在两台计算机中,如果更改未反映,则说明存在缓存问题,您可以根据以下文档进行配置:
http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29
Maybe you have a cache problem. I remember that Toplink (base of EclipseLink) has the cache mechanism ON by default. So if this is the scenario:
Machine A
these modifications aren't reflected inMachine B
since they don't have updated its cache.Machine A
orMachine B
.You can verify it changing a record directly on database and verifying that it is reflected in both machines, if the change isn't reflected you have a cache problem and you can configure it according to following documentation:
http://wiki.eclipse.org/Introduction_to_Cache_%28ELUG%29