简体   繁体   English

Java EE共享库?

[英]Java EE Shared Libs?

I'm having trouble getting a shared library working in a Java EE environment. 我在Java EE环境中无法使用共享库。

In particular, the library contains some helpers for common JMS activities. 特别是,该库包含一些用于常见JMS活动的帮助程序。 However, as soon as the code enters a library function that requires anything from javax.jms it's triggering a ClassNotFound exception (claiming it can't find javax.jms.Message , for instance.) 但是,一旦代码进入需要javax.jms任何内容的库函数,它就会触发ClassNotFound异常(例如,声称找不到javax.jms.Message 。)

How do I get around this? 我该如何解决? I'm placing the shared lib under $AS_HOME\\lib\\endorsed -- does it belong elsewhere? 我将共享库放在$AS_HOME\\lib\\endorsed -它是否在其他位置? I have tried also packaging all the dependencies inside the jar; 我也尝试过将所有依赖项打包到jar中。 this doesn't seem to make much of a difference. 这似乎并没有太大的区别。

I am really hoping this is much more straightforward than it is seeming right now. 我真的希望这比现在看来简单得多。 In order just to get it working, I've refactored the helper into a helper-per-module within each component that requires the functionality. 为了使其正常工作,我已经将帮助程序重构为需要该功能的每个组件中的每个模块帮助程序。 Note that this is working, so I'm thinking the issue at this point is just classpath problems? 请注意,这是可行的,因此我认为此时的问题只是类路径问题? Thanks for any advice! 感谢您的任何建议!

The best practice is to put the jms.jar in: 最佳实践是将jms.jar放入:

 $AS_HOME/domains/<your domain>/lib

but you could always just place them in: 但您始终可以将它们放在:

$AS_HOME/lib/

If you are not familiar with domains, take a quick glance at Concept of a GlassFish Domain 如果您不熟悉域,请快速浏览GlassFish域的概念

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM