I think the problem is fixt. Have a look of the last version from svn: http://svn.apache.org/viewcvs.cgi/webservices/wss4j/trunk/src/org/apache/ws/security/util/Loader.java?view=markup
Regards,
Christian
On 1/18/06, Roland Schwarzkopf <[EMAIL PROTECTED]> wrote:
Hi,
I found a probably found an error in org.apache.ws.security.util.Loader,
in the getResource method. The javadoc says it will use three
classloaders to find the resource, first the thread context class
loader, then the class loader that loaded the Loader class and finally
the system class loader. But the method does not use the context class
loader. (I also checked the last version from cvs). Is that intentional
or just a mistake?
This doesn't work for me if the, because I placed the wss4j.jar in
tomcat/shared/lib (thus it is loaded by the shared class loader of
tomcat) and the CryptoFactory want's to load a property file that
resides in tomcat/webapps/axis/WEB-INF/classes (or a WEB-INF/classes
directory of another webapp), which means only the webapps class loader
can find it. I could of course place the property files in
tomcat/shared/lib, but I guess that's the wrong place. The wss4j.jar
needs to be there, because other webapps need it (a servlet of another
webapp should call a webservice (using encryption)). So the only
possibility i saw was replacing the method with the follwing. Does
anyone see any problems with that code? Or any better ways to solve the
problem?
Regards,
Roland
static public URL getResource(String resource) {
ClassLoader classLoader = null;
URL url = ""
try {
// ------------ This is the part I inserted
-----------------------------------
// First try the thead context class loader
classLoader = getTCL();
if (classLoader != null) {
log.debug("Trying to find [" + resource + "] using "
+ classLoader + " class loader.");
url = ""
if (url != null) {
return url;
}
}
// ------------------------------------------------------------------------
// We could not find resource. Ler us now try with the
// classloader that loaded this class.
classLoader = Loader.class.getClassLoader();
if (classLoader != null) {
log.debug("Trying to find [" + resource + "] using "
+ classLoader + " class loader.");
url = ""> if (url != null) {
return url;
}
}
} catch (Throwable t) {
log
.warn(
"Caught Exception while in
Loader.getResource. This may be innocuous.",
t);
}
// Last ditch attempt: get the resource from the class path. It
// may be the case that clazz was loaded by the Extentsion class
// loader which the parent of the system class loader. Hence the
// code below.
log.debug("Trying to find [" + resource
+ "] using ClassLoader.getSystemResource().");
return ClassLoader.getSystemResource(resource);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
