axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Richard Emberson <ember...@phc.net>
Subject junit, TestCaseClassLoader, and Axis' logging
Date Mon, 08 Apr 2002 01:36:44 GMT

If one uses Junit's TestCaseClassLoader loader - letting one run the
test with its own classloader,
then the logging system throws an exception:

.java.lang.ClassCastException:
org.apache.commons.logging.impl.LogFactoryImpl
        at
org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:504)
        at
org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:350)
        at
org.apache.commons.logging.LogFactory.getLog(LogFactory.java:400)
        at org.apache.axis.MessageContext.<clinit>(Unknown Source)


Why? because it is trying to cast a LogFactoryImpl to a LogFactory ....
why does this fail? because
they are from different classloaders, LogFactory from the initial loader
and the LogFactoryImpl
from the loader from the test you are running .... and we all know that
classes are identified
by their type and classloader (not their type alone).

What is the fix? there is not one ... you simply can not run your junit
tests each in their own
classloader environments.

Richard


Mime
View raw message