How to configure EAR to access an existing Websphere Shared Lib?

I am using JSF2 with Websphere 7. I created the generic lib successfully and pointed the application using the Webpsphere Admin Console, and it works successfully. But we really want not to point to the Shared Lib through the WAS Admin Console, but to have some application level configuration, for example, in the deployment.xml file, etc., which we can point to the name of this shared isolated Lib and use it, I went through via SO and google, but didnโ€™t find anything like that. However, I know that there is a commercial application, but I do not know how to do it.
This question is from How can I specify a link to a shared library at the web module level in Websphere 6.1 deployment descriptors? is what I need, but I don't want to specify version numbers or jar names as response states

+6
source share
3 answers

I found a way just by following what the WAS management console actually ran.

Create a deployment.xml file in your EAR file if you do not already have one. You will find a link to the class loader as shown below

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

Modify it and add a link to the shared Liberary section created on the server, as shown below.

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

@dbreaux also showed a way. Confirmation of my own answer, as well as my needs, but many thanks to dbreaux for the advice.

+9
source

The problem is that you donโ€™t want to configure each application separately or donโ€™t want to use the admin console at all? You can link a shared library to a whole server , which may be preferable for each application.

Another way to create these application associations is in WebSphere-specific .xmi deployment files. They are created during deployment, but can also be included in WAR / EAR files. I donโ€™t know if this will help you at all. If that were the case, the official way to create them is to use one of the Deployment Tools in advance, but since they are just XML, you can feel comfortable creating them manually.

+4
source

To add further details to Shahzeb's answer: My environment: Websphere 8.5; Windows 7 (Eclipse Luna to create a test .war file)

I installed the war file exported from eclipse on the websphere server using the websphere console. Then export it again and unzip it to see what the web page automatically adds to it to create the EAR.

 [folder]META-INF [folder]ibmconfig [file]application.xml [file]ibm-application-bnd.xmi [file]ibm-application-runtime.props [file]MANIFEST.MF [file]was.module [file]was.policy [file]was.webmodule [file]myWAR.war 

And the deploy.xml file is placed in .. \ ibmconfig \ cells \ defaultCell \ applications \ defaultApp \ deployments \ defaultApp \

whose contents are in the form


 <?xml version="1.0" encoding="UTF-8"?> <appdeployment:Deployment xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:appdeployment="http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi" xmi:id="Deployment_1417052686904"> <deployedObject xmi:type="appdeployment:ApplicationDeployment" xmi:id="ApplicationDeployment_1417052686904" deploymentId="0" startingWeight="1" binariesURL="$(APP_INSTALL_ROOT)/[server service name]Cell/myWAR.ear" useMetadataFromBinaries="false" enableDistribution="true" createMBeansForResources="true" reloadEnabled="false" appContextIDForSecurity="href:[server service name]Cell/myWAR" filePermission=".*\.dll=755#.*\.so=755#.*\.a=755#.*\.sl=755" allowDispatchRemoteInclude="false" allowServiceRemoteInclude="false" asyncRequestDispatchType="DISABLED" standaloneModule="true" enableClientModule="false"> <targetMappings xmi:id="DeploymentTargetMapping_1417052686904" enable="true" target="ServerTarget_1417052686904"/> <classloader xmi:id="Classloader_1417052686904" mode="PARENT_FIRST"/> <modules xmi:type="appdeployment:WebModuleDeployment" xmi:id="WebModuleDeployment_1417052686904" deploymentId="1" startingWeight="10000" uri="myWAR.war" containsEJBContent="0"> <targetMappings xmi:id="DeploymentTargetMapping_1417052686905" target="ServerTarget_1417052686904"/> <classloader xmi:id="Classloader_1417052686905"/> </modules> <properties xmi:id="Property_1417052686904" name="metadata.complete" value="true"/> </deployedObject> <deploymentTargets xmi:type="appdeployment:ServerTarget" xmi:id="ServerTarget_1417052686904" name="server1" nodeName="[server service name]"/> </appdeployment:Deployment> 

(Since I have no reputation, I have to do it all in the text ..)

+2
source

Source: https://habr.com/ru/post/893467/


All Articles