users@glassfish.java.net

Re: appclient fails with ClassNotFoundException

From: <glassfish_at_javadesktop.org>
Date: Tue, 20 Apr 2010 08:15:33 PDT

Thanks for sending the EAR.

I think the problem is that your app client JAR file is indexed, but the index does not describe all the classes reachable from the Class-Path in the app client JAR's manifest. (Part of the motivation behind JAR indexing is for the root JAR to index ALL the classes and resources reachable from that root JAR to optimize downloading JARs in applets or applications loaded over the network. This allows the class loader to know precisely which JAR contains each class and resource.)

As described in the JAR index spec

http://java.sun.com/javase/6/docs/technotes/guides/jar/jar.html#Overview

when a class loader encounters the index, it trusts it completely. The client JAR's index is the first one the class loader encounters, and it lists only the classes in the app client JAR itself, not the other "downstream" classes. Trusting the index, the class loader rejects the attempt to find the class that is in fact in the EJB JAR.

Try removing the index from the app client JAR - or try building the index so it lists all the downstream classes as well - and see if that helps. The "jar -i " command applied to your app client JAR should build the complete index for you, so long as the JARs listed in the app client JAR's Class-Path exist where the Class-Path says they should.

I think other JARs in your app also had indexes in them that you might want to double-check.

- Tim
[Message sent by forum member 'tjquinn']

http://forums.java.net/jive/thread.jspa?messageID=398045