Tagged: shared library
March 23, 2017 at 12:59 am #516704
Earlier we were using WAS 7 and MyEclipse 10 IDE plugin to deploy WAR project. Recently we shifted to WAS 8.5.5. and MyEclipse 2016. As WAS 8.5.5 provides its own implementation of “org.codehaus.jackson” JAR which (v1.6) it conflicts with latest JARs used by our project. Hence we are forced to use “Isolated Shared Library” feature of WebSphere to provide latest libraries through another class loader.
1) How to add shared library to “WAR” project in MyEclipse? I explored following post; but didn’t help.
– The deployment path of MyEclipse is too large to add custom deployment.xml.
As of now we are using wsadmin script to deploy and add shared library; but we want to use MyEclipse deployment for this.
2) We also tried adding shared library through admin console when app is deployed using MyEclipse; but there is no “save/ok” option enabled when WAR is deployed in MyEclipse plugin folder. It works only when it is deployed in WAS profile installedApps folder.
3) Does any other version of MyEclipse support this feature?
Please find attached a sample project which we are using for testing adding shared library in MyEclipse. Create a WebSphere shared library with isolated class loader with following JARs:
Attachments:You must be logged in to view attached files.March 23, 2017 at 11:56 pm #516848
Websphere doesn’t read config files from WARs. It only reads from EARs.
You need to create an EAR with the web module added,follow the steps outlined in this thread and deploy the EAR : https://www.genuitec.com/forums/topic/save-shared-library-reference-in-ear/
The length of the deployment path should not be an issue.
Hope this helps. Please let us know how it works for you.
MyEclipse SupportMarch 24, 2017 at 1:15 am #516853
Thanks for the reply. I’ve tried solution mentioned in: https://www.genuitec.com/forums/topic/save-shared-library-reference-in-ear/ .
MyEclipse deployment location is somewhere in plugin folder. Even if I have to manually place libraries.xml in there, Windows won’t allow it as the path is too large. The path generate in my case is: “C:\workspace-myeclipse\.metadata\.plugins\com.genuitec.eclipse.blue.websphere.core\WebSphere_20_Application_20_Server_20_7_2e_0_20_at_20_localhost\test-shared-lib\test-shared-lib”.
Is there any way to use custom deployment location in MyEclipse?March 24, 2017 at 9:39 am #516881
You should not have trouble working with long paths in MyEclipse. Can you please let us know what exact issue you are facing with long path in Windows? Are you trying to edit the files from the Windows Explorer?
By default the deployment mode is ‘In-Workspace’. This mode deploys EAR files from the Workspace location rather than being copied to the WebSphere profile location. The ‘Classic’ deployment mode deploys the project to the Websphere server location. Please refer to this document for more information : https://www.genuitec.com/products/myeclipse/learning-center/websphere/overview-rad-comparison-of-myeclipse-for-websphere/#deploymentTypes
MyEclipse SupportMarch 26, 2017 at 1:14 am #517069
When I try to add “META-INF/ibmconfig/cells/defaultCell/nodes/defaultNode/servers/defaultServer/libraries.xml” to “C:\workspace-myeclipse\.metadata\.plugins\com.genuitec.eclipse.blue.websphere.core\WebSphere_20_Application_20_Server_20_8_2e_5_20_at_20_localhost\test-shared-lib\test-shared-lib.ear\”, I get following error:
“The filename(s) would be too long for the destination folder.” This is Windows explorer error for long file path.
How to deploy to profile folder instead of workspace/plugin folder in MyEclipse? I couldn’t find it in the link you’ve provided.
AzharMarch 27, 2017 at 12:31 pm #517229
You can deploy to the profile location by changing the deployment mode to ‘Classic’. Double click on the Websphere server in the Servers view to open the Overview page.In the ‘Advanced publishing settings’ section, select ‘Classic’ Deployment mode and save the changes. Now all the deployments will be made to the Websphere profile location. Note that this mode will take longer to publish and hot-sync changes.
To get shared libraries working with in-workspace mode, you will need to create an EAR project in your workspace first. Unfortunately, it’s not possible to ship server configuration files with web projects. You will need to deploy the EAR project instead of the web one. Here are steps which should get you going with shared libraries. Open the application.xml (and if you don’t have one, generate it using project’s context menu, “Generate Deployment Descriptor Stub” under “Java EE Tools”) and switch to the Design tab. Click on ‘Launch Websphere Application Configuration editor’ link and this will generate the ibmconfig folder in your EAR project’s META-INF folder. You need to additionally create following folder
META-INF/ibmconfig/cells/defaultCell/nodes/defaultNode/servers/defaultServer. Inside the defaultServer folder, create
libraries.xmlfile with following content (modify the content accordingly):12345678910<?xml version="1.0" encoding="UTF-8"?><xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"xmlns:libraries="http://www.ibm.com/websphere/appserver/schemas/5.0/libraries.xmi"><libraries:Library xmi:id="Library_1426110634506" name="lib-name" description="My shared lib"isolatedClassLoader="true"><classPath>C:\path\to\my\shared.lib.jar</classPath></libraries:Library></xmi:XMI>
Now right click on
deployment.xmllocated at :
META-INF/ibmconfig/cells/defaultCell/applications/defaultApp/deployments/defaultApp, choose Open with -> MyEclipse XML Editor and add the library entry. Example deployment.xml:12345678<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_1262775196208"><deployedObject xmi:type="appdeployment:ApplicationDeployment"xmi:id="ApplicationDeployment_1262775196208" startingWeight="10"><classloader xmi:id="Classloader_1262775196208" mode="PARENT_FIRST"><libraries xmi:id="LibraryRef_1426114915340" libraryName="lib-name"/></classloader></deployedObject></appdeployment:Deployment>
Please note that the
deployment.xmlneed to be under <classloader> element.
Alternatively, if you prefer to use WAS Admin Console to do all the XML changes for you, then create configuration files structure in EAR project first and change deployment mode to Classic mode. This way you can make changes in Admin Console and save them to server config files. Observe server console output for list of modified files (e.g.
cells/localhostNode06Cell/applications/TestEARSharedLibs.ear/deployments/TestEARSharedLibs/deployment.xml). Once you are done with edits, you need to copy changes into your project config files to have them persisted between deployment and to have them working in the in-workspace mode. The mapping is relatively simple:
cells/localhostNode06Cell/applications/TestEARSharedLibs.ear/deployments/TestEARSharedLibs/deployment.xmlconfiguration file from
configurationfolder of your WAS installation maps to
cells/defaultCell/applications/defaultApp/deployments/defaultApp/deployment.xmlfile in your EAR’s project
META-INFdirectory – all names translate to
default*. Only those files generated by MyEclipse plus
library.xmlyou have created yourself should be relevant to shared libraries support.
Hope this helps.