Win a copy of Emmy in the Key of Code this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Loading Log4j.jar from another Jar

Ranch Hand
Posts: 62
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I intend to create a common jar which contains all Java Classes related to implementing log4j logging functionality.I have implemented Singleton (GoF) design pattern in a class SLogger to return single instance of log4j across the application.
I have created customlogger.jar file with all class files related to log4j logging and lib folder containing log4j-1.2.8.jar file.
Following shows the directory structure :

Contents of MANIFEST.MF is
Manifest-Version: 1.0
Class-Path: lib/log4j-1.2.8.jar

When i add the in my other application and try to make use of logging functionality i get following error

java.lang.NoClassDefFoundError: org.apache.log4j.PropertyConfigurator

My other application is deployed in a Websphere application server 6.1.

In the Class SLogger, i have a code statement,which raises error

Is it possible to refer to log4j.jar from customlogger.jar?
I want to make any application in the world to be making use of customlogger.jar.
I think the J2EE application server can load the customlogger.jar but it cannot somehow load log4j.jar
Posts: 24654
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your webapp's WEB-INF/lib folder you should have both customlogger.jar and log4j.jar. Check that for a start.

(I didn't get the part about you implementing a singleton so you could have a single instance of log4j. That seemed pointless to me because log4j already does that sort of thing internally. But maybe you did that to solve a real problem you were having.)
Liar, liar, pants on fire! refreshing plug:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!