• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Websphere 6.1 - Apache commons logging with log4j does not work

 
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
I have an existing application which is succesffully running in WAS 5.1 and WASD.We have migrated the appliication in WAS 6.1 and RAD 7.0.
While deployed successfuly the code in WAS 6.1 and RAD 7.0 and start the server we are facing the same type of error in the console.



Could you please suggest me should Log4j(log4j-1.2.9.jar) compatible with Websphere 6.1 or we need higher version log4j jar for WAS 6.1.

Please suggest.

Thanks in advance.
Regards
Sumanta Panda
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
I wanted to know whether this version Log4j(log4j-1.2.9.jar) will still work on WAS6.1 or we will have to upgrade to later version on log4j?

Please suggest.

Thanks for your time.

Regards
Sumanta Panda
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, the class isn't even being found! It doesn't matter which version you use if it can't find the class.

You' probably have a classloader issue.

Understanding WebSphere and Classloader Issues

Find the code that is causing the problem, and try and invoke the logger programatically and see if it still can't be found.

-Cameron McKenzie
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Cameron,
Thanks for your response.
Could you please suggest me how to fix this error?

Thanks for your time.

Regards
Sumanta Panda
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your best bet is probably to include it in the enterprise application or web application you're working with. That way it won't interfere with other applications and you'll have better control over the logging options.
 
sumanta panda
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,
Our log4j.properties file is not properly loaded in the server .So we are getting the error java.lang.ds
NoClassDefFoundError: org.apache.log4j.Logger


Please suggest me how to fix this error.

Thanks in advance.
Regards,
Sumanta Panda
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

sumanta panda wrote: ... So we are getting the error
java.lang.NoClassDefFoundError: org.apache.log4j.Logger



The Problem is that WAS6.1.0.19 uses commons-logging-1.0.3 .
commons-logging-1.1.1 raises this exception in bundle with log4j.

This (solution) replacement of commons-logging via jcl-over-slf4j works very well . I tested it successfully yesterday.
 
Greenhorn
Posts: 27
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am sorry that I am replying to one of the oldest thread. Long time back I had found a solution in another forum. Wish I could recall and paste that link.

I have tested the solution provided by them on Websphere 6.1 and websphere 7 and it works.

1) No need to have commons-logging.properties in the classpath. No need to change the class loading policy to PARENT_LAST.
2) Under META-INF/services, create a file by name "org.apache.commons.logging.LogFactory". The content of file should be just "org.apache.commons.logging.impl.Log4jFactory"
3) Now comes the most important part. Websphere 6.1 and 7.0 still uses apache-commons-logging "1.0.3" version.
a) In Websphere 6.1, go to <WEBSPHERE INSTALLED FOLDER>/plugins and open the jar "com.ibm.ws.runtime_6.1.0.jar". It contains the commons logging file
b) Download apache commons logging 1.0.3 version from its archived website. Open the downloaded jar. When you compare the contents with the jar file of Websphere you will find that the downloaded version of apache commons logging has the below extra files
- org.apache.commons.logging.impl.Log4JCategoryLog.class
- org.apache.commons.logging.impl.Log4jFactory.class
- org.apache.commons.logging.impl.Log4JLogger.class
- org.apache.commons.logging.impl.LogKitLogger.class
All other files are common files in both websphere and apache library.
c) Now from the downloaded apache commons logging jar, delete the common files. Only retain the above mentioned file. Once you are done, you will basically have a stripped version of apache commons logging 1.0.3. Put this stripped jar in WEB-INF/lib
d) You are all set, restart the server.
4) In Websphere 7.0, the apache commons logging can be found at <WEBSPHERE INSTALLED FOLDER>/plugins/com.ibm.ws.prereq.commons-logging.jar. All other activities will be similar to the one explained above
5) With this approach, we are not changing core library file of Websphere. Neither we are changing the class loading policies.

As I mentioned above, this solution was found in some forum which I am unable to recall. I have basically tried to provide as much information as I can. I had done the above activities in one of my previous project and was successful.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Nischit Shetty , its really help me in IBM WebSphere 8 also.
Just Kindly Explain how it works please.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic