[logging] Always get a LogConfigurationException...

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[logging] Always get a LogConfigurationException...

Jason Burrows
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.

Thanks
Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Simon Kitching
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.

Which version of commons-logging are you using?

And just a check: you are using commons-logging.jar (not
commons-logging-api.jar)?

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Jason Burrows
Hi - sorry, that would be important information!
I'm using 1.0.4, and yes, I am using commons-logging.jar and not
commons-logging-api.jar.

Thanks!


On 6/20/05, Simon Kitching <[hidden email]> wrote:

> 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.
>
> Which version of commons-logging are you using?
>
> And just a check: you are using commons-logging.jar (not
> commons-logging-api.jar)?
>
> Regards,
>
> Simon
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Simon Kitching
In reply to this post by Jason Burrows
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: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Jason Burrows
> 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?
>

No - not an embedded system.  Just running with JDK 1.5.0 with nothing
special or interesting being done to it.  In fact, if I add a test to
check that out:

if ( this.getClass().getClassLoader() == null){...} else {...}

I can see that getClassLoader is not returning null (for my test class anyway).

Thanks
Jason

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Jason Burrows
If I import the source directly into my project then I don't get this
issue for my simple test (which makes it really hard to debug), but
this isn't a reasonable solution for the real project I am working on.

Does that information help at all?  I can't really think of any good
reason why this would be the case, unless there is some problem using
the binaries with Java 5?

Thanks
Jason


On 6/21/05, Jason Burrows <[hidden email]> wrote:

> > 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?
> >
>
> No - not an embedded system.  Just running with JDK 1.5.0 with nothing
> special or interesting being done to it.  In fact, if I add a test to
> check that out:
>
> if ( this.getClass().getClassLoader() == null){...} else {...}
>
> I can see that getClassLoader is not returning null (for my test class anyway).
>
> Thanks
> Jason
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Always get a LogConfigurationException...

Jason Burrows
So I can also run this test correctly (without the commons-logging
source, just using the jar file) if I run it directly from the command
line, and not from within eclipse.  Everything else works fine from
within Eclipse (using tons of things - including other parts of the
commons collection).

Can anyone think of any reason I'd be getting my problem only when
running from within Eclipse?  I can be sure that I'm using the same
jvm in either case (made sure by fully qualifying the path to java.exe
when testing from the command line).



On 6/21/05, Jason Burrows <[hidden email]> wrote:

> If I import the source directly into my project then I don't get this
> issue for my simple test (which makes it really hard to debug), but
> this isn't a reasonable solution for the real project I am working on.
>
> Does that information help at all?  I can't really think of any good
> reason why this would be the case, unless there is some problem using
> the binaries with Java 5?
>
> Thanks
> Jason
>
>
> On 6/21/05, Jason Burrows <[hidden email]> wrote:
> > > 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?
> > >
> >
> > No - not an embedded system.  Just running with JDK 1.5.0 with nothing
> > special or interesting being done to it.  In fact, if I add a test to
> > check that out:
> >
> > if ( this.getClass().getClassLoader() == null){...} else {...}
> >
> > I can see that getClassLoader is not returning null (for my test class anyway).
> >
> > Thanks
> > Jason
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]