shibboleth-dev - class loading order
Subject: Shibboleth Developers
List archive
- From: Tom Scavo <>
- To: Shibboleth Development <>
- Subject: class loading order
- Date: Mon, 22 Aug 2005 08:26:49 -0400
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=gN1YQ0S4zDDaNKFBJ4a+z2ShQdY+CR0rK9JtTgIZKwS5OniAZ0di01teCHRfUs1Qarhoi45oAZkp5YocgursjpD8qw7nLn22VgPY43ZVk90R4WKKzLJj3xiW6/sm1dPTxLgy/yeDvX6M2ynW1r7I/3iqtwvjx29Mx/Jy3GB4jOY=
According to the Tomcat documentation, a web application loads classes
and other resources in the following order:
1. Bootstrap classes of your JVM
2. System class loader classes (described above)
3. /WEB-INF/classes of your web application
4. /WEB-INF/lib/*.jar of your web application
etc.
So the classloader attempts to resolve unpacked classes and resources
under /WEB-INF/classes *before* looking in JAR files under
/WEB-INF/lib.
Thus the build classpath in build.xml is more-or-less correct:
<path id="build.path">
<pathelement path="${classpath}" />
<pathelement location="${build}" />
<fileset dir="${custom}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${endorsed}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${buildlibs}">
<include name="**/*.jar" />
</fileset>
</path>
We could quibble about the order of the JAR files, but the build
directory is searched first, which is most important. (Btw, why is
${custom} in this classpath? This seems like a bug.)
Also in build.xml, when running unit tests, the following classpath is used:
<classpath>
<fileset dir="${custom.libs}">
<include name="*.jar"/>
</fileset>
<filelist refid="test.path"/>
</classpath>
where
<path id="test.path">
<path refid="build.path"/>
<pathelement location="${tests}"/>
</path>
This results in the following search order:
1) Extension JARs
2) Shibboleth classes
3) Shibboleth JARs
4) Extension classes
which doesn't seem right. Shouldn't the order be:
1) Extension classes
2) Extension JARs
3) Shibboleth classes
4) Shibboleth JARs
I'm assuming that Extension classes and JARs should be searched before
Shibboleth classes and JARS, which seems reasonable. However, in
extension-build.xml the build classpath is as follows:
<!-- Shibboleth Libraries -->
<classpath refid="build.path" />
<!-- Shibboleth Classes -->
<classpath>
<pathelement location="${build}" />
</classpath>
<!-- Extension libraries -->
<classpath>
<fileset dir="${ext.lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
That's not right since 1) the second classpath element ${build} is
redundant, and 2) Shibboleth classes and libraries are searched before
extension libraries. The order should be, I think, just the opposite:
<!-- Extension libraries -->
<classpath>
<fileset dir="${ext.lib}">
<include name="**/*.jar" />
</fileset>
</classpath>
<!-- Shibboleth Classes and Libraries -->
<classpath refid="build.path" />
Moreover, when running unit tests in extension-build.xml, the
following pathelement should be inserted at the *beginning* of the
above list:
<classpath>
<pathelement location="${ext.classes}" />
</classpath>
Otherwise JUnit will not be able to find the unit test class files.
Let me know what you think.
Tom
- class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
- Re: class loading order, Tom Scavo, 08/22/2005
- Re: class loading order, Chad La Joie, 08/22/2005
Archive powered by MHonArc 2.6.16.