• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Loading Log4j.jar from another Jar

Ranch Hand
Posts: 62
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 customlogger.java 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: 27451
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.)
What do you have in that there bucket? It wouldn't be a tiny ad by any chance ...
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic