Thursday, March 5, 2009

Log4j Slf4j issues in Spring Dm

If you try to use log4j in any application under Spring DM we may get some ClassNotFound exceptions . The issue could be the following

com.springsource.slf4j.org.apache.log4j-1.5.6.jar - is present in

springsource-dm-server-ee-1.0.2.RELEASE\repository\bundles\ext directory and it shares a package org.apache.log4j

Now when you put your log4j jar into repository\bundles\usr - it also shares the same package
org.apache.log4j .

Hence one in the repository is resolved first . So all requests to classes in the log4j jar within package org/apache/log4j will give ClassNotFound Exceptions as it looks for these classes in slf4j jar .

The easiest way i resolved this was by deleting com.springsource.slf4j.org.apache.log4j-1.5.6.ja from the repository . This change did not affect any logging of the spring Dm server.

Another way to solve this is

Import-Package: org.apache.log4j;bundle-symbolic-name="com.springsource.org.apache.log4j"

http://forum.springsource.org/showthread.php?t=73354

No comments:

 
Free Domain Names @ .co.nr!