1

I'm attempting to set up a web project's dependency on a utility project. My utility project is set up with the 'Utility Module' project facet and 'Java 5'. When I select 'Java EE Module Dependencies' in the properties of my web project, my utility project does not appear. I believe this is the problem and would love to resolve it!

I did also try the following: Since the Utility project does, however, show up in the 'Java EE Module Dependencies' in the properties of my EAR, I selected the dependency in my EAR and found that the Utility was now available to my web project, it appears as. e.g., Utility.jar. Ultimately, this seems to be the desired effect. However, the issue appears to be with the server's dependency resolution. The Jar is distributed to the EAR and added to the Web's Manifest as, i.e., Utility.jar. But the Utility project's dependencies are not being included along with that (or something to that affect). Note: My company uses Ivy for dependency resolution. The problem here is that the specific Jar that I'm receiving NoClassDefFoundError s on is included in the Web's dependency as well (i.e., the Jar exists in the WEB-INF/lib directory). So I'm not sure why, if this is a viable solution, the Jar isn't able to resolve the dependency from the Web's classloader.

Also worth mentioning, the Utility project has been added to the 'Project' tab of the web project's 'Build Path'; therefore, I'm not receiving any compilation errors.

I will continue to dig in and try to find a solution but I would appreciate any help or guidance along the way.

Here are some of the resources I've found related to my exhaustive research:


Solution Posted Below

To anyone who was looking into this issue for me, I appreciate your time. Hopefully this will help someone with a similar issue down the road.

Sincerely, Beez

4

2 に答える 2

0

Web プロジェクトは、ユーティリティ プロジェクトの依存関係を持つことはできません。これは、WAR ファイルには存在しない EAR 構造であるため、EAR ファイル専用です。

Eclipse Java EE エコシステムは非常に過剰に設計されています。これは Eclipse 自体によってゼロから開発されたのではなく、IBM の商用 Eclipse 製品の 1 つから直接採用されたのではないかと私は強く疑っています。これが良いアイデアであったかどうかは、議論の余地があります。

于 2011-06-09T18:44:44.477 に答える
0

以前は、Web プロジェクトのプロパティ > [Java EE モジュールの依存関係] > [Web ライブラリ] でユーティリティ プロジェクトを確認できませんでした。理由はわかりません。モジュールが表示されましたが、チェックしたときに「適用」と「OK」をクリックし、プロパティを再度開いたときにモジュールのチェックが外れていました。そこで、依存関係を手動で org.eclipse.wst.common.component ファイルに追加しました。

<dependent-module archiveName="Utility.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/Utility/Utility">
    <dependency-type>uses</dependency-type>
</dependent-module>

これで問題は完全に解決され、アプリは完全に機能しています!

于 2011-08-18T13:04:23.260 に答える