Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure EAR to access exisiting Websphere Shared Lib?

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

like image 708
Shahzeb Avatar asked Jul 25 '11 01:07

Shahzeb


1 Answers

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

<classloader xmi:id="Classloader_1311552732281" mode="PARENT_FIRST">

Modify it and add reference to the shared Liberary created on server like below

 <classloader xmi:id="Classloader_1311552732281" mode="PARENT_FIRST">
        <libraries libraryName="JSF2_SHARED_LIB" sharedClassloader="true"/>
 </classloader>

@dbreaux has also shown a way .Accpeting my own answer as fits my needs better but big thanks to dbreaux too for advice.

like image 191
Shahzeb Avatar answered Sep 19 '22 00:09

Shahzeb