Hello, I am using log4j 1.2alpha6, and have run into a problem with the new ClassLoader behavior. I am running some JUnit tests through Ant 1.4.1, and when log4j tries to load my appender class named in the properties file, it fails with this error:
log4j:ERROR: A "foo.mumble.MyAppender" object is not assignable to a "org.apache.log4j.Appender" variable. The problem is that the log4j classes have been loaded by the AntClassLoader, but the log4j Loader class is trying to use the current thread's context class loader, which is the default JRE application loader. I have tried setting the current thread's context class loader to the Ant class loader, but that caused even more problems (linkage errors, etc.). I posted a message to the Ant users mailing list, and a very helpful person suggested that the behavior described in the log4j FAQ is a misinterpretation of the Java 2 preferred method. He contends that the context class loader was introduced to "make standard extensions like JNDI work," but that generally "business code should continue to use the current classloader (getClass().getClassLoader())." You can find the message at: http://marc.theaimsgroup.com/?l=ant-user&m=101139178705895&w=2 I don't know a whole lot about class loaders, but in light of this person's comments, could the new behavior be incorrect? Or at least maybe it could try to load the class using the default (Class.forName()) and *then* if it doesn't work, failsafe to getContextClassLoader()? Thanks, Dave Herman [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>