vkp_stack
vkp_stack

Reputation: 157

How to create shared libraries in WebSphere to share jar files

I can see the class path from log files as

was.install.root = /IBM/WebSphere/AppServer
user.install.root = /IBM/WebSphere/AppServer/profiles/AppSrv01
Java Home = /IBM/WebSphere/AppServer/java/8.0/jre
ws.ext.dirs = /IBM/WebSphere/AppServer/java/8.0/lib:/IBM/WebSphere/AppServer/profiles/AppSrv01/classes:/IBM/WebSphere/AppServer/classes:/IBM/WebSphere/AppServer/lib:/IBM/WebSphere/AppServer/installedChannels:/IBM/WebSphere/AppServer/lib/ext:/IBM/WebSphere/AppServer/web/help:/IBM/WebSphere/AppServer/deploytool/itp/plugins/com.ibm.etools.ejbdeploy/runtime
Classpath = /IBM/WebSphere/AppServer/profiles/AppSrv01/properties:/IBM/WebSphere/AppServer/properties:/IBM/WebSphere/AppServer/lib/startup.jar:/IBM/WebSphere/AppServer/lib/bootstrap.jar:/IBM/WebSphere/AppServer/lib/jsf-nls.jar:/IBM/WebSphere/AppServer/lib/lmproxy.jar:/IBM/WebSphere/AppServer/lib/urlprotocols.jar:/IBM/WebSphere/AppServer/deploytool/itp/batchboot.jar:/IBM/WebSphere/AppServer/deploytool/itp/batch2.jar:/IBM/WebSphere/AppServer/java/8.0/lib/tools.jar
Java Library path = /IBM/WebSphere/AppServer/lib/native/linux/x86_64/:/IBM/WebSphere/AppServer/java/8.0/jre/lib/amd64/compressedrefs:/IBM/WebSphere/AppServer/java/8.0/jre/lib/amd64:/IBM/WebSphere/AppServer/bin:/IBM/WebSphere/AppServer/nulldllsdir:/usr/lib64:/usr/lib:
Orb Version = IBM Java ORB build orb80-20170207.00 

and I have some jar files in /WEB-INF/lib path of application server and some class files in /WEB_INF/class path .

In /WEB_INF/lib path , I have following jar files .

aopalliance-1.0.jar
commons-io-1.4.jar
jcl-over-slf4j-1.6.1.jar
spring-aop-4.2.5.RELEASE.jar
spring-expression-4.2.5.RELEASE.jar
bcprov-jdk16-1.46.jar
freemarker-2.3.16.jar
log4j-1.2.14.jar
spring-beans-4.2.5.RELEASE.jar
spring-web-4.2.5.RELEASE.jar
commons-codec-1.4.jar
ibmpkcs-8.0.jar
slf4j-api-1.6.1.jar
spring-context-4.2.5.RELEASE.jar
spring-webmvc-4.2.5.RELEASE.jar
commons-fileupload-1.2.2.jar
javassist-3.19.0-GA.jar
slf4j-log4j12-1.6.1.jar
spring-core-4.2.5.RELEASE.jar

I want to move javassist-3.19.0-GA.jar to shared library to avoid class conflict . I have read the steps to configure and adding the shared library in WebSphere from IBM . Now i want to know what should i write in shared library path ? Is it something like ${WAS_INSTALL_ROOT}/WEB_INF/lib/javassist-3.19.0-GA.jar ? and should i remove javassist-3.19.0-GA.jar from /lib path?

Upvotes: 0

Views: 2405

Answers (2)

Jarid
Jarid

Reputation: 2018

$WAS_INSTALL_ROOT will get you as far as /IBM/WebSphere/AppServer; the closest you can get to your app binaries with a default server variable is $USER_INSTALL_ROOT, which will get into profiles/AppSrv01, and app binaries are in the "installedApps" directory within that location.

That said, pointing to the application binaries in your shared library is a very bad idea. If you don't want that jar to be loaded by the WAR class loader, then get it out of there and put it somewhere else. I would note that I don't fully understand WHY you're putting it into a shared library (what is it conflicting with?), so maybe some clarification would help with that as well.

Upvotes: 1

Yash
Yash

Reputation: 13874

In WebSphere you can create Shared Libraries for localizing or sharing dependencies among different applications. Here's IBM help document for the same. Please add comment or inbox if you need help with the same.

https://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/tcws_sharedlib.html

And you should keep in mind that both the types of files (server shared library and application lib) will end up in the classpath for your application to read. If you provide two different versions in any combination, it can always produce ambiguity.

Upvotes: 1

Related Questions