You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Dmitry S. Kravchenko" <di...@vsetech.ru> on 2006/07/09 03:19:50 UTC

java.lang.NoClassDefFoundError: org/apache/log4j/Category

I'm insuccessfully trying to use log4j in Tomcat webapps.

Recently I tried to recognize, where I should put jar and property files to
make system work. I found, that if I put jar file in global lib directory,
and properties file in WEB-INF/classes directory, system does not ever start
with the message "No appenders could be found to the logger".

Then I found, that this error disappears, when I delete log4j jar from
global directory and put it only to the directory WEB-INF/lib (what itself
is very strange for me. why something should change because of position of
some jar file???).

So, after I put files into these directories, server able to start
successfully.

But now I can't open any page from my web application, because I have the
following exception:

java.lang.NoClassDefFoundError: org/apache/log4j/Category

The absurdity of situation is that I don't use Category class, because it
said to me, that it is obsolete! 

I have some servlets, I have some class with the following code in
constructor

if( logger == null ) {
      logger = Logger.getLogger("MetSession");
    }

(logger is static)

and the following code for logging 

logger.debug( prefix + message );

Of course class Category exists in jar file. 

So what I can do?

Thank you.

Dims.


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


Re: java.lang.NoClassDefFoundError: org/apache/log4j/Category

Posted by James Stauffer <st...@gmail.com>.
Please give the stack trace for the exception.

On 7/8/06, Dmitry S. Kravchenko <di...@vsetech.ru> wrote:
> I'm insuccessfully trying to use log4j in Tomcat webapps.
>
> Recently I tried to recognize, where I should put jar and property files to
> make system work. I found, that if I put jar file in global lib directory,
> and properties file in WEB-INF/classes directory, system does not ever start
> with the message "No appenders could be found to the logger".
>
> Then I found, that this error disappears, when I delete log4j jar from
> global directory and put it only to the directory WEB-INF/lib (what itself
> is very strange for me. why something should change because of position of
> some jar file???).
>
> So, after I put files into these directories, server able to start
> successfully.
>
> But now I can't open any page from my web application, because I have the
> following exception:
>
> java.lang.NoClassDefFoundError: org/apache/log4j/Category
>
> The absurdity of situation is that I don't use Category class, because it
> said to me, that it is obsolete!
>
> I have some servlets, I have some class with the following code in
> constructor
>
> if( logger == null ) {
>       logger = Logger.getLogger("MetSession");
>     }
>
> (logger is static)
>
> and the following code for logging
>
> logger.debug( prefix + message );
>
> Of course class Category exists in jar file.
>
> So what I can do?
>
> Thank you.
>
> Dims.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

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