mace-opensaml-users - loading additional configuration with XMLConfigurator
Subject: OpenSAML user discussion
List archive
- From: Kenny Pearce <>
- To: mace-opensaml-users <>
- Subject: loading additional configuration with XMLConfigurator
- Date: Tue, 1 Apr 2008 11:10:12 -0400
- Organization: Hx Technologies
Hi,
I'm getting odd classloader behavior with the XMLConfigurator. I am
creating a SAML extension (an additional message type), so I made a new
XML file and after calling DefaultBootstrap.bootstrap, I call
XMLConfigurator.load with an InputStream to my XML file (please tell me
if this is not the correct way to do this). During loading I get a
ClassNotFoundException for my builder, which is the first class
mentioned in the XML.
I took a look at the XMLConfigurator code and the offending section
(lines 328-329) looks like this:
ClassLoader classLoader = this.getClass().getClassLoader();
Class clazz = classLoader.loadClass(className);
The first thing I noticed is that the javadoc for Class.getClassLoader
says: "Some implementations may use null to represent the bootstrap
class loader. This method will return null in such implementations if
this class was loaded by the bootstrap class loader." So this is
technically a bug in that it relies on a particular feature of the Sun
JVM which is not required by the Java spec. I'm not totally sure what
the correct way to do this is; guess you can check if it's null and
call the static method ClassLoader.getSystemClassLoader if it is. This,
however, is neither here nor there as I am getting a
ClassNotFoundException and not a NullPointerException.
I next tried inserting the line
"this.getClass().getClassLoader().loadClass("my.class.name");" into my
code immediately before I call XMLConfigurator.load, where
"my.class.name" is copied directly from the exception output and so is
exactly the same. It does not throw an exception in my code.
I don't know if this is relevant, but I am running under Tomcat and my
code is in WEB-INF/classes, whereas the OpenSAML library code is in a
jar in a directory specified in the shared.loader property.
Any idea what's going on?
--
Kenny Pearce
<>
Hx Technologies
- loading additional configuration with XMLConfigurator, Kenny Pearce, 04/01/2008
- Re: [OpenSAML] loading additional configuration with XMLConfigurator, Xavier Drudis Ferran, 04/01/2008
- Re: [OpenSAML] loading additional configuration with XMLConfigurator, Manuela Stanica, 04/01/2008
- Re: [OpenSAML] loading additional configuration with XMLConfigurator, Kenny Pearce, 04/01/2008
- Re: [OpenSAML] loading additional configuration with XMLConfigurator, Brent Putman, 04/01/2008
- Re: [OpenSAML] loading additional configuration with XMLConfigurator, Kenny Pearce, 04/02/2008
Archive powered by MHonArc 2.6.16.