[logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

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

[logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Jason Burrows
Hi again -

I have isolated my problem.  It only happens when I include j2ee.jar.
It doesn't matter if I am using it or not.  If I don't include this
jar, the call is fine 100% of the time, if I do include the jar
(putting it in /jre/lib/ext/ or using Eclipse's 'add external jar...')
then it will fail unless I am running a j2ee environment.  Obviously I
don't need to include this jar generally, but it really annoying to
have to remove it when ever I want to switch from developing my
components for when they are running in tomcat to when they are
running standalone.  Just to clarify - the exact same test code with
only the one line will work when j2ee.jar is not available but will
fail when it is available.

Again, my problem is when I make this call:

LogFactory.getLog(CommonsLoggingTest.class);

I get this (when j2ee.jar is available, when it is not available the
call is fine):

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.doTest(CommonsLoggingTest.java:27)
        at com.redhawk.testing.CommonsLoggingTest.main(CommonsLoggingTest.java:45)
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)
        ... 5 more
Caused by: java.lang.NullPointerException
        at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
        ... 6 more

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

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Simon Kitching
On Tue, 2005-06-21 at 17:44 -0700, Jason Burrows wrote:
> Hi again -
>
> I have isolated my problem.  It only happens when I include j2ee.jar.

Have you checked to see whether j2ee.jar contains commons-logging?
  jar tf j2ee.jar | grep org.apache.commons.logging

If it does, then try running your app while ensuring commons-logging.jar
is *before* j2ee.jar in the classpath so that your local version takes
priority.

It might be that j2ee.jar contains commons-logging 1.0.2 or somesuch,
which would then explain why the line-number reporting the
null-pointer-exception doesn't make sense.

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] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Jason Burrows
> > Hi again -
> >
> > I have isolated my problem.  It only happens when I include j2ee.jar.
>
> Have you checked to see whether j2ee.jar contains commons-logging?
>   jar tf j2ee.jar | grep org.apache.commons.logging
>
> If it does, then try running your app while ensuring commons-logging.jar
> is *before* j2ee.jar in the classpath so that your local version takes
> priority.
>
> It might be that j2ee.jar contains commons-logging 1.0.2 or somesuch,
> which would then explain why the line-number reporting the
> null-pointer-exception doesn't make sense.
>
> Regards,
>
> Simon

j2ee.jar does not contain commons.logging using the command you
specified.  Also, changing its position in the class path relative to
the commons-logging jar file doesn't change the situation at all.

I am using the j2ee.jar file that comes as part of Sun's application
server.  Are other people here successfully developing with that jar
file and commons-logging?  I suppose I can switch over to Tomcat's
implementation (the servlet-api.jar file will probably give me what I
need) as that may by why it works under Tomcat (doesn't use j2ee.jar),
but I'd still like to know what the problem is.

Thanks for your help!
Jason

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

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

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

> > > Hi again -
> > >
> > > I have isolated my problem.  It only happens when I include j2ee.jar.
> >
> > Have you checked to see whether j2ee.jar contains commons-logging?
> >   jar tf j2ee.jar | grep org.apache.commons.logging
> >
> > If it does, then try running your app while ensuring commons-logging.jar
> > is *before* j2ee.jar in the classpath so that your local version takes
> > priority.
> >
> > It might be that j2ee.jar contains commons-logging 1.0.2 or somesuch,
> > which would then explain why the line-number reporting the
> > null-pointer-exception doesn't make sense.
> >
> > Regards,
> >
> > Simon
>
> j2ee.jar does not contain commons.logging using the command you
> specified.  Also, changing its position in the class path relative to
> the commons-logging jar file doesn't change the situation at all.
>
> I am using the j2ee.jar file that comes as part of Sun's application
> server.  Are other people here successfully developing with that jar
> file and commons-logging?  I suppose I can switch over to Tomcat's
> implementation (the servlet-api.jar file will probably give me what I
> need) as that may by why it works under Tomcat (doesn't use j2ee.jar),
> but I'd still like to know what the problem is.
>
> Thanks for your help!
> Jason

Update:
This problem does not exist at all with commons-logging 1.0.3.

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

Reply | Threaded
Open this post in threaded view
|

RE: [logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Jeff Martin
In reply to this post by Jason Burrows
SunOne 8.1 includes commons logging in appserv-rt.jar.

-----Original Message-----
From: Jason Burrows [mailto:[hidden email]]
Sent: Wednesday, June 22, 2005 2:38 PM
To: [hidden email]
Subject: Re: [logging] Problem isolated - get a
LogConfigurationException when I have j2ee.jar in my project


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

> > > Hi again -
> > >
> > > I have isolated my problem.  It only happens when I include j2ee.jar.
> >
> > Have you checked to see whether j2ee.jar contains commons-logging?
> >   jar tf j2ee.jar | grep org.apache.commons.logging
> >
> > If it does, then try running your app while ensuring commons-logging.jar
> > is *before* j2ee.jar in the classpath so that your local version takes
> > priority.
> >
> > It might be that j2ee.jar contains commons-logging 1.0.2 or somesuch,
> > which would then explain why the line-number reporting the
> > null-pointer-exception doesn't make sense.
> >
> > Regards,
> >
> > Simon
>
> j2ee.jar does not contain commons.logging using the command you
> specified.  Also, changing its position in the class path relative to
> the commons-logging jar file doesn't change the situation at all.
>
> I am using the j2ee.jar file that comes as part of Sun's application
> server.  Are other people here successfully developing with that jar
> file and commons-logging?  I suppose I can switch over to Tomcat's
> implementation (the servlet-api.jar file will probably give me what I
> need) as that may by why it works under Tomcat (doesn't use j2ee.jar),
> but I'd still like to know what the problem is.
>
> Thanks for your help!
> Jason

Update:
This problem does not exist at all with commons-logging 1.0.3.

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

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

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Jason Burrows
appserv-rt is not in my path - I didn't put the entire app server lib
directory in my path, just j2ee.jar.

Even if somehow it is being included through some means I can't see, I
still don't understand why replacing commons-logging with 1.0.3 fixes
all my problems, and why changing the position of 1.0.4 in my
classpath has no effect (if the problem is that j2ee.jar is
introducing another version).


On 6/22/05, Jeff Martin <[hidden email]> wrote:
> SunOne 8.1 includes commons logging in appserv-rt.jar.

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

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Problem isolated - get a LogConfigurationException when I have j2ee.jar in my project

Simon Kitching
In reply to this post by Jason Burrows
On Tue, 2005-06-21 at 17:44 -0700, Jason Burrows wrote:

> Hi again -
>
> I have isolated my problem.  It only happens when I include j2ee.jar.
> It doesn't matter if I am using it or not.  If I don't include this
> jar, the call is fine 100% of the time, if I do include the jar
> (putting it in /jre/lib/ext/ or using Eclipse's 'add external jar...')
> then it will fail unless I am running a j2ee environment.  Obviously I
> don't need to include this jar generally, but it really annoying to
> have to remove it when ever I want to switch from developing my
> components for when they are running in tomcat to when they are
> running standalone.  Just to clarify - the exact same test code with
> only the one line will work when j2ee.jar is not available but will
> fail when it is available.
>

This doesn't make sense to me. There is no way I can think of for the
presence of a jar whose classes are not being used to cause a null
pointer exception.

Just to be paranoid I downloaded Sun's appserver (8.1) and tried it, and
could not duplicate your problem:

$ cat Foo.java
import org.apache.commons.logging.LogFactory;
import org.apache.commons.logging.Log;

public class Foo  {
        public static void main(String[] args)  throws Exception {
                Log log = LogFactory.getLog("Test");
                log.info("Hello, World");
        }
}
$ javac -classpath commons-logging-1.0.4.jar Foo.java
$ java -classpath commons-logging-1.0.4.jar:. Foo
23/06/2005 21:51:50 Foo main
INFO: Hello, World
$ java -classpath j2ee.jar:commons-logging-1.0.4.jar:. Foo
23/06/2005 21:51:56 Foo main
INFO: Hello, World



I have no idea what the cause of your problem is, but I am quite sure it
isn't the presence or absence of j2ee.jar. There's something else going
on, and I wish you luck figuring it out.

Regards,

Simon


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