gpt4 book ai didi

java - Glassfish 2 在 Glassfish 4 上的应用程序 : "Cannot resolve reference... because there are 2 ejbs in the application"?

转载 作者:太空宇宙 更新时间:2023-11-04 14:39:38 25 4
gpt4 key购买 nike

所以,在过去的两周里我一直在努力解决这个问题。我的任务是将应用程序服务器从 glassfish 2 升级到 glassfish 4,在 GF2 上运行的应用程序在我脸上抛出此错误:“无法解析引用......因为带有接口(interface)的应用程序中有 [2] ejb。 ”

该应用程序被封装在一个耳朵中,里面有两个 war 模块。问题是,这两个模块都具有相同的 ejb 项目,作为在 NetBeans 上进行开发时添加到库中的库。这意味着这两个 war 的 WEB-INF/lib 文件夹中确实有相同的 ejb.jar。我只是找不到解决这个问题的方法。我尝试从这两个项目的库中删除 ejb,然后将 ejb-jar 添加到 Ear 的根目录中,然后在这些 war 项目的 list 中定义类路径。这导致 NetBeans 端出现大量错误,并导致这些项目的构建失败。

我正在使用命令行 ant 来构建 war 并将它们放入耳朵中。

问题是项目的源代码不是由我完成的,我不确定我应该在哪里解决这个问题。

最佳答案

我想说你的方向是正确的。将 ejb-jar 文件放入 .ear 文件的 lib 文件夹中。然而,EE7 中存在关于放置(例如持久性根)的“规则更改”。也许如果您的 ejb-jar 中有一个 persistence.xml 文件,当您将其放入 .ear 存档的根目录时,它会产生您看到的错误

In the Java Persistence API 1.0, JAR files could be located at the root of an EAR file as the root of the persistence unit. This is no longer supported. Portable applications should use the EAR file's library directory as the root of the persistence unit.

您可以找到全文here

您可能想探索 ee5 和 ee7 之间的差异,尤其是 GF2.x 和 gf4.x。您可能会发现这些链接很有用 ee7 highlightsee6 highlights

关于java - Glassfish 2 在 Glassfish 4 上的应用程序 : "Cannot resolve reference... because there are 2 ejbs in the application"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25093763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com