views:

860

answers:

2

Hi,

On WebLogic 10.0 I use the "Shared J2EE Libraries" ( http://download.oracle.com/docs/cd/E11035_01/wls100/programming/libraries.html ) feature of WLS to group some jars which would need to be accessible in multiple ear's. These jars resided on the system classpath, and I try to move them into the shared lib from there.

My problem is:

  • in the WLS web admin console I click the shared library (named "theSharedLib") under Deployments
  • the "Applications that reference this Library" list is empty
  • I can also undeploy the lib using weblogic.Deployer, but on the next restart of the server it complains about the referenced library missing when loading the referencing application

So it seems that at startup the referencing takes effect, but in runtime WLS somehow forgets about this (do I need some magic trick here?).

I could also achieve this:

  • undeploy theSharedLib (no complaining)
  • undeploy someReferencingApp (ok)
  • deploy someReferencingApp (error! missing lib)
  • deploy theSharedLib (ok)
  • deploy someReferencingApp (ok; app gets listed in the web console; however on next restart, or after random other deployments, the list gets empty again)

Structure of shared lib ear in exploded directory format:

  • META-INF
    • MANIFEST.MF
    • application.xml
  • lib
    • (stuff I need to share as jars)
  • dummyejb.jar (because it has to contain something)

MANIFEST.MF contains:
..
Extension-Name: theSharedLib
Specification-Version: 1.0
Implementation-Version: 1.0.0
..

application.xml contains basic elements (one dummyejb ejb module).

Structure of referencing app:

Among others, it has META-INF/weblogic-application.xml, containing:

<?xml version="1.0"?>
<weblogic-application>
<library-ref>
<library-name>theSharedLib</library-name>
<specification-version>1.0</specification-version>
<implementation-version>1.0.0</implementation-version>
<exact-match>true</exact-match>
</library-ref>
</weblogic-application>

What could be the problem? Should I do anything else in the shared lib or in the referencing apps to (1) have the references list correctly and most importantly (2) share the jars among the apps?

I presume the shared jars inside the lib are loaded using the same classloader in the shared lib for each application, behaving pretty much like the sys classpath behavior. Could you please also confirm this?

Thanks!

A: 

I think that the MANIFEST.MF of the shared lib (which is an EAR) should contain a Class-Path entry referencing the JARs in lib (this tells the classloader where to look to find classes). Something like this:

Class-Path: lib/foo.jar lib/bar.jar lib/foobar.jar
Pascal Thivent
A: 

Thanks for the information. Actually this is what I found out:

1) The listings of referencing applications disappear from the web console, if a referencing application fails at deployment (strange - maybe it has deeper reasons, but this is quite consistent now).

2) Unfortunately the classes inside a shared lib are loaded by the classloaders of the different referencing applications, so this way it is not possible to share for example interface classes for inter-application communication purposes.

ron