Websphere 6.1 服务器
我在 websphere 服务器中加载 jar 时遇到问题。一些 jar 存在于 WEB-INF/lib 中,一些存在于本地硬盘驱动器中(例如,c:\lib 文件夹)。我如何在应用程序启动期间加载所有这些罐子。如果加载了 WEB-INF jar,则不会加载外部 jar,反之亦然......需要帮助......
I have an issue in loading jars in websphere server. Some of the jars are present in WEB-INF/lib and some are present in local hard drive(ex., c:\lib folder). How can i load all these jars, during the startup of the application. If WEB-INF jars are loaded, external jars are not getting loading and viceversa..Need help on this....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
WebSphere 有一个类加载器层次结构,父类加载器看不到子类加载器,因此当您将应用程序的不同方面放在不同的位置时,您会感到惊讶。
切勿尝试将应用程序 jar 放入 WebSphere 自己的 lib 目录中,也切勿调整 WebSphere 自己的类路径。有一种结构化的方法可以使外部罐子可见,我稍后会解释这一点。
您可以在三个位置放置 JAR 文件以便加载它们。到目前为止,最好的方法是将 JAR 放在 WEB-INF/lib 中。您可以指定搜索顺序首选项 PARENT LAST,以便这些优先于 websphere 提供的 jar - 但请注意,某些基本 jar 无法被覆盖 例如,您无法替换 IBM 安全性。
其次,您可以将 jar 添加到 EAR 文件的根目录中。注意,层次结构现在开始发挥作用,WEB-INF/lib jar 可以看到 EAR jar,但 EAR jar 无法看到 WEB-INF/lib jar。
最后您可以指定一个WebSphere“共享库”。请参阅信息中心了解如何操作,通过控制台非常简单。共享库有一个类路径,您可以向其中添加 jar。然后,您将共享库分配给单个应用程序或整个服务器。
你的 WEB 应用程序可以再次看到共享库,但我不相信对话是真的。因此,将框架代码放入共享库中可能不适合您。
WebSphere has a hierarchy of classloaders, parent classloaders cannot see child classloaders, hence you get surprises when you put different aspects of your application in different places.
Never attempt to place application jars in WebSphere's own lib directory, and never adjust WebSphere's own class path. There is ana rchitected way to make external jars visible, I'll explain that in a moment.
There are three places that you can put JAR files so that they will be loaded. By far the the best is simply to place the JARs in WEB-INF/lib. You can specify the search order preference PARENT LAST so that these take prececdence over jars supplied by websphere - but note that some fundamental jars cannot be over-ridden You cannot replace the IBM security for example.
Second you can add jars to the root of the EAR file. Noe that the hierarchy comes into play now, WEB-INF/lib jars can see EAR jars but EAR jars cannot see WEB-INF/lib jars.
Finally you can specify a WebSphere "Shared Libarary". See the Info Centre for how, it's very easy through the console. A shared library has a classpath, you add jars to that. Then you allocate the shared libarary to individual applicaitons or whole servers.
Once again You WEB app can see the shared library, but i don't beleive taht the convers is true. Hence putting framework code in a shread library may not work for you.