commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Probst" <andpr...@gmx.net>
Subject Resolved: Re: [logging] LogConfigurationException
Date Sat, 07 Jun 2003 07:40:04 GMT
On 4 Jun 2003 at 23:41, Craig R. McClanahan wrote:

> PS:  The exception message described in the message below is *absolutely*
> and *positively* related to screwing up the class loader hierarchy of the
> test environment, and has nothing to do with commons-logging as such
> (unless they are using a verson of C-L before 1.0.3, all of which still
> had some class loader issues).  Most likely, the tester has exposed the
> C-L classes in more than one class loader (a class "foo.bar" loaded from
> class loader A is not considered to be the same as class "foo.bar" loaded
> from class loader B -- even if the bytecodes happen to be the same) --
> that is pretty much guaranteed to cause fatal problems, no matter what
> particular classes you are trying to load.
> 
> PPS: Specific note to Andreas -- make sure that you are using Commons
> Logging 1.0.3, and also make sure that you are executing your tests in a
> separate JVM so that you don't get messed up by the CLASSPATH that was
> specified on your Ant execution.
> 

The problem is within the UI test runners of JUnit. They bring 
with them a custom classloader, which causes the 
LogConfigurationException. Unfortunately Log4j doesn't work 
either.

Solution: Disable "Reload classes every run" or start JUnit with 
command line option -noloading before the name of the Testsuite.

Andreas
> >
> > On 4 Jun 2003 at 8:03, Andreas Probst wrote:
> >
> > > Thank you both Achim and Anthony for your replies.
> > >
> > > I still can't get it to work. Achim, I tried your code - and it
> > > works. Then I commented the junit-call out of the main method -
> > > and it works.
> > >
> > >     public static void main(String[] args)
> > >     {
> > >         //BasicConfigurator.configure();
> > >         logger.debug("test");
> > >         junit.swingui.TestRunner.run(AllTests.class);
> > >     }
> > >
> > > If I run the code above, the "test" gets logged as expected, but
> > > after that the exception below is thrown.
> > >
> > > Is there a known issue with JUnit 3.7?
> > >
> > > log4j: Finished configuring.
> > > 04 Jun 2003 07:50:21,122 DEBUG AllTests: test
> > > Exception in thread "main" java.lang.ExceptionInInitializerError
> > >         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > > Method)
> > >         at
> > > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorI
> > > mpl.java:39)
> > >         at
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodA
> > > ccessorImpl.java:25)
> > >         at java.lang.reflect.Method.invoke(Method.java:324)
> > >         at
> > > junit.runner.BaseTestRunner.getTest(BaseTestRunner.java:111)
> > >         at junit.awtui.TestRunner.runSuite(TestRunner.java:455)
> > >         at junit.awtui.TestRunner.start(TestRunner.java:536)
> > >         at junit.awtui.TestRunner.main(TestRunner.java:382)
> > >         at junit.awtui.TestRunner.run(TestRunner.java:387)
> > >         at de...AllTests.main(AllTests.java:29)
> > > Caused by: org.apache.commons.logging.LogConfigurationException:
> > > org.apache.commons.logging.LogConfigurationException:
> > > org.apache.commons.logging.LogConfigurationException: Class
> > > org.apache.commons.logging.impl.Log4JLogger does not implement
> > > Log
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFac
> > > toryImpl.java:532)
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFac
> > > toryImpl.java:272)
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFac
> > > toryImpl.java:246)
> > >         at
> > > org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
> > >         at de...AllTests.<clinit>(AllTests.java:21)
> > >         ... 10 more
> > > Caused by: org.apache.commons.logging.LogConfigurationException:
> > > org.apache.commons.logging.LogConfigurationException: Class
> > > org.apache.commons.logging.impl.Log4JLogger does not implement
> > > Log
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
> > > LogFactoryImpl.java:416)
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFac
> > > toryImpl.java:525)
> > >         ... 14 more
> > > Caused by: org.apache.commons.logging.LogConfigurationException:
> > > Class org.apache.commons.logging.impl.Log4JLogger does not
> > > implement Log
> > >         at
> > > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(
> > > LogFactoryImpl.java:412)
> > >         ... 15 more
> > >
> > > Andreas
> > >


Mime
View raw message