update:

If using plain vanilla servlets then putting the .jar file in the
WEB-INF/lib directory and doing nothing to the classpath log4j works just
fine.

It seems that if you use reflection to instantiate a class that is using
log4j then the appropriate loj4j .jar file needs to be in the classpath
otherwise the relected class will not be instantiated.

Craig

-----Original Message-----
From: Ceki Gülcü [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 22, 2001 2:37 PM
To: LOG4J Users Mailing List
Subject: Re: Log4j and servlets - Reflection Error



Craig,

No idea at all. Sorry I can't help. Ceki

At 09:55 22.08.2001 -0500, Craig Newlander wrote:
>Strange error here.
>In my Servlet class (foo) I defined a static field member as
>
>private static Category log;
>
>and in its Constructor is
>log = Category.getRoot();
>I can now log until the cows come home.
>
>Now then, I have another class (foobar) which is instantiated via
reflection
>by foo from foo's service() method
>
>foobar has a static field member as
>private static Category log;
>and in its Constructor is
>log = Category.getInstance(  this.getClass().getName() );
>
>and when foo tries to reflect foobar I recevied a
>java.lang.reflect.InvocationTargetException:
java.lang.NoClassDefFoundError:
>org/apache/log4j/Category
>foobar never gets instantiated foo keeps chugging along and logs without a
>hitch?
>
>if I remove the log = from foobars construtor foobar can be reflected just
>fine.
>
>Any ideas?

--
Ceki Gülcü - http://qos.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to