Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Websphere Shared Libraries "Priority"?

Tags:

websphere

In Websphere, it is possible to create a "Shared Libraries" and associate with applications. I would want to know, in terms of position in classpath, what's the position of the shared libs are added? That means, I want to know, in case of duplicated resources, which will have higher "priority" to be loaded, Shared Libraries or the EAR/WAR itself.

For example, assume in my application, I have a resources called appConfig.xml, and I am creating a local directory in the app server, putting another appConfig.xml in that directory. If I tries to load the resources (e.g. open input stream) in my app, which file will be loaded?

I have searched for a while and can find nowhere mentioning this. Though I can try it out by myself by experimenting, I would want to know the official expected behavior, if any.

Thanks a lot

like image 625
Adrian Shum Avatar asked Apr 03 '12 08:04

Adrian Shum


2 Answers

The ordering amongst class loaders uses the so-called "class loader mode", which is either "parent first" (and application classes/resources last) or "parent last" (with application classes/resources first). For a single application class loader, the class path ordering will be:

  1. module class paths
  2. dependency class paths (Class-Path in MANIFEST.MF)
  3. shared library class paths

There is no configuration option to change the ordering. I do not think this ordering is explicitly state in documentation, but I also think it's highly unlikely to change. Regardless, I would not recommend relying on it. I would recommend ensuring you use unique resource/class names within a single class loader.

like image 153
Brett Kail Avatar answered Dec 08 '22 05:12

Brett Kail


I think here: http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Fcrun_classload.html you'll find everything.

like image 37
dpedro Avatar answered Dec 08 '22 07:12

dpedro