如何配置 EAR 来访问现有的 Websphere 共享库?
我将 JSF2 与 Websphere 7 一起使用。我已经成功创建了一个共享库,并使用 Webpsphere 管理控制台指向了应用程序,并且它工作成功。但我们真正想做的是不必通过 WAS 管理控制台指向该共享库,而是在部署.xml 等中进行某种应用程序级别配置,我们可以指向该共享隔离库的名称并使用它。我已经浏览过SO和谷歌,但没有发现任何事情可以做到这一点。然而,我知道有商业应用程序在这样做,但不知道如何做。
这个问题来自如何在 Websphere 6.1 部署描述符中的 Web 模块级别指定共享库引用? 正是我所追求的,但我不想指定版本号或 jar 名称,因为答案指出
I am using JSF2 with Websphere 7 . I have created a shared lib successfully and have pointed application using Webpsphere Admin Console and it works successfully . But what we really want to do is to not have to point to that Shared Lib via WAS Admin Console but have some sort of application level configuration e.g in deployment.xml etc which we can point to the name of that Shared Isolated Lib and use it . I have gone through SO and google but not found any thing doing that . I however know that there are commercial application doing it but do not know how .
This question from How can I specify a shared library reference at the web module level in Websphere 6.1 deployment descriptors? is closely what I am after but I not want to specify version numbers or jar names as the answer states
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我通过简单地遵循 WAS Admin Console 实际执行的操作找到了一种方法。
如果您还没有 EAR 文件,请在 EAR 文件中创建一个 deployment.xml。
您将找到对类加载器的引用,如下所示
修改它并添加对在服务器上创建的共享库的引用,如下所示
@dbreaux 也显示了一种方法。接受我自己的答案更适合我的需求,但也非常感谢 dbreaux 的建议。
I found a way by simply following what WAS Admin Console was actually doing.
Create a deployment.xml in your EAR file if you do not have one already .
You will find a reference to class loader like below
Modify it and add reference to the shared Liberary created on server like below
@dbreaux has also shown a way .Accpeting my own answer as fits my needs better but big thanks to dbreaux too for advice.
问题是否只是您不想单独配置每个应用程序,或者您根本不想使用管理控制台?您可以将共享库与整个服务器关联,这可能会比为每个应用程序都这样做更好。
创建这些应用程序关联的另一种方法是在特定于 WebSphere 的 .xmi 部署文件中。它们是在部署时创建的,但也可以包含在 WAR/EAR 文件中。我不知道这对你是否有帮助。如果可以,提前创建它们的官方方法是使用 部署工具,但由于它们只是 XML,因此您可以放心创建它们手动。
Is the issue just that you don't want to have to configure each application separately, or that you don't want to use the admin console at all? You can associate a shared library with an entire server, which might be preferable to doing it for each app.
The other way to create those application associations is in the WebSphere-specific .xmi deployment files. These are created when you deploy but can also be included in WAR/EAR files. I don't know if that would help you at all. If it would, the official way to create them ahead of time is using one of the Deployment Tools, but since they're just XML, you may feel comfortable creating them manually.
在 Shahzeb 的回答中添加额外的细节:
我的环境:Websphere 8.5; Windows 7;(Eclipse Luna生成测试.war文件)
我已经通过websphere控制台在websphere服务器上安装了从eclipse导出的war文件。
然后再次导出并解压,看看websphere自动添加了什么来生成EAR。
并且文件deployment.xml放置在
..\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\
其内容形式为
(因为我没有声誉,所以我必须全部以文本形式完成..)
To append extra details to Shahzeb's answer:
My environment: Websphere 8.5; Windows 7;(Eclipse Luna to generate testing .war file)
I have installed the war file exported from eclipse on websphere server by websphere console.
Then exported it again and unpack it to see what websphere automatically add to it to generate EAR.
And the file deployment.xml is placed in
..\ibmconfig\cells\defaultCell\applications\defaultApp\deployments\defaultApp\
whose content in form of
(Since I have no reputation, I have to do it all in text.. )