Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

J2EE app client class loading?

79 views
Skip to first unread message

DEBEDb

unread,
Jun 7, 2006, 12:26:54 PM6/7/06
to
Hi all,

It looks like the class loading is not working for me as described at
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/ccli_classloading.html.


Here is what is happening:

I have an EAR, in which a client jar (clientlauncher.jar) resides. The
Class-Path in its Manifest.mf is as follows:

Class-Path: plugins/framework plugins/checkservices
plugins/transferservices plugins/alerts plugins/pr
plugins/pr/achapps plugins/pr/wireapps
pr-hotfix.jar pr.jar

The main class of the clientlauncher.jar, Launcher, should load
another class. But it looks like it always does that from pr.jar,
even when I put a modified version of the second class
under, say, EAR_ROOT/plugins/pr (which is first on the classpath).

Here's an experiment. I created the Launcher class as follows:

public static void main(String[]argv) {
String mainClass = argv[0];
ClassLoader loader = Launcher.class.getClassLoader();
String resource = mainClass.replaceAll("\\.", "/") + ".class";
System.out.println(mainClass +
": " +
loader.getResource(resource));
URL url = null;
int i = 1;
for (Enumeration en = loader.getResources(resource);
en.hasMoreElements();) {
url = (URL) en.nextElement();
System.out.println(i + ". " + mainClass + ": " + url);
i++;
}

And here is what I get, when com.ph.pr.common.install.Noop class is
both in pr.jar and in plugins/pr, under the EAR:

com.ph.pr.common.install.Noop:
jar:file:/D:/apps/wcmsuite73/installedApps/WCM73_PaymentsAndReporting.ear/pr.jar!/com/ph/pr/common/install/Noop.class


1. com.ph.pr.common.install.Noop:
jar:file:/D:/apps/wcmsuite73/installedApps/WCM73_PaymentsAndReporting.ear/pr.jar!/com/ph/pr/common/install/Noop.class

2. com.ph.pr.common.install.Noop:
file:/D:/apps/wcmsuite73/installedApps/WCM73_PaymentsAndReporting.ear/plugins/pr/com/ph/pr/common/install/Noop.class

In other words, as you can see, the JAR one gets loaded first!
(But it certainly does find the one under plugins/pr if I do
getResources()).

That is to say, it seems that the order of Class-Path: entries
in Manifest.mf is not honored...

Thanks.

Charly Oz

unread,
Jun 8, 2006, 9:22:17 AM6/8/06
to
If you are using WASv6, have a look in the Admin Console under
Troubleshooting. There is a class loader tool that shows what is loaded, etc
and may be of some use to you with this.


"DEBEDb" <deb...@gmail.com> wrote in message
news:1149697614.5...@j55g2000cwa.googlegroups.com...

DEBEDb

unread,
Jun 8, 2006, 9:48:39 AM6/8/06
to
But this is a client, where would I find it in the Admin Console? It's
running in a separate JVM, how would the AdminConsole
find that?

DEBEDb

unread,
Jun 8, 2006, 3:12:31 PM6/8/06
to
Update: Putting a modified file inside pr-hotfix.jar works
as expected. So it's only directories in the manifest
classpath that are a problem, the JAR order works as
specified.

0 new messages