commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Kitching <skitch...@apache.org>
Subject Re: [logging] Always get a LogConfigurationException...
Date Tue, 21 Jun 2005 01:11:18 GMT
On Mon, 2005-06-20 at 17:54 -0700, Jason Burrows wrote:
> Hi All -
> 
> I'm having a problem with a non j2ee java application using
> commons-logging.  I'm using JDK 1.5.0_1 and Eclipse.  I have been able
> to use commons-logging from within Tomcat, but I have no luck when I
> try to just use it in a standalone Java application.  I am under the
> impression that I should not have to supply a specific logging
> implementation because Java 5 has one built in (which I am using in my
> application directly with no problems), and if that fails, it will use
> the "SimpleLog".  I have tried setting various system properties, such
> as 'org.apache.commons.logging.LogFactory' and
> 'org.apache.commons.logging.Log', but it doesn't seem to have any
> effect.
> 
> I have reduced it to this - when I call:
> 
>         Log log=  LogFactory.getLog(CommonsLoggingTest.class);
> 
> I get:
> 
> Exception in thread "main"
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> java.lang.NullPointerException (Caused by
> java.lang.NullPointerException) (Caused by
> org.apache.commons.logging.LogConfigurationException:
> java.lang.NullPointerException (Caused by
> java.lang.NullPointerException))
> 	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
> 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
> 	at com.redhawk.testing.CommonsLoggingTest.main(CommonsLoggingTest.java:31)
> Caused by: org.apache.commons.logging.LogConfigurationException:
> java.lang.NullPointerException (Caused by
> java.lang.NullPointerException)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
> 	at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
> 	... 4 more
> Caused by: java.lang.NullPointerException
> 	at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
> 	... 5 more
> 
> 
> Any information you can offer would be greatly appreciated.

It would appear that the problem originates with ling 374 of
LogFactoryImpl (release 1.0.4) which is this:
    logInterface = this.getClass().getClassLoader().loadClass
         (LOG_INTERFACE);

As "this" cannot be null, and neither can this.getClass(), I would guess
that getClassLoader is returning null.

But that should only ever happen in JVM1.1, or in embedded systems where
everything is being loaded via the bootclassloader.

You aren't developing an embedded system are you?

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message