Results 1 to 10 of 10

Thread: Spring 3 web Jars - issue as Bundle - with org.apacje.log4j imports

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default Spring 3 web Jars - issue as Bundle - with org.apacje.log4j imports

    My application uses Log4j for logging . I have downloaded log4j bundle version 1.2.15 from spring repository.

    In my application bundle i have import

    org.apache.log4j;bundle-symbolic-name="com.springsource.org.apache.log4j",

    When i use Spring 3.0 web related jars i get uses conflict because

    Spring web has imports like

    org.apache.log4j;version=" [1.2.15, 2.0.0)" [org.springframework.web-3.0.0.RELEASE.jar]

    I feel spring resolves to imports from slf4j present in DM server lib.

    How do i solve this issue ?

  2. #2
    Join Date
    Oct 2008
    Location
    Winchester, UK
    Posts
    535

    Default

    The slf4j bundles in lib only export slf4j and commons logging packages and not log4j packages.

    I recommend using the Admin Console to explore the state dump that is produced when the uses conflict is detected. You'll be able to see any multiple suppliers of packages and, with a bit of thoughtful analysis, work out what's going on.
    Glyn Normington
    SpringSource

  3. #3
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    I have verified with latest version(2.0.1) of DM kernel and Dm server.

    Dm kernel doesnt export it , but Dm server does have it.

    \springsource-dm-server-2.0.1.RELEASE\repository\ext

    Code:
    com.springsource.slf4j.org.apache.log4j-1.5.10.jar
    manifest which exports

    Code:
    Export-Package: org.apache.log4j;provider="slf4j";version="1.2.15";use
     s:="org.slf4j"

  4. #4
    Join Date
    Oct 2008
    Location
    Winchester, UK
    Posts
    535

    Default

    You should be able to use that version of the org.apache.log4j package, but if you must specify a bundle symbolic name, it should of course be "com.springsource.slf4j.org.apache.log4j" rather than "com.springsource.org.apache.log4j".

    (In general, I would avoid specifying bundle symbolic name on a package import as it will tend to constrain the resolver and may give rise to uses constraint violations, but I guess you had some specific reason for doing so.)
    Glyn Normington
    SpringSource

  5. #5
    Join Date
    Nov 2008
    Location
    London,UK
    Posts
    299

    Default

    Glyn,

    My issue came because of multiple bundles exporting "org.apache.log4j"

    In my application i want to use log4j. For this reason i add bundle symbolic name to "com.springsource.org.apache.log4j" in my application bundles.

    This causes issue whn i use Spring Web bundles which has imports for org.apache.log4j (without any explicit bundle symbolic name), which in some cases resolves to com.springsource.slf4j.org.apache.log4j.

    This causes uses voilation -

    My app -[uses] - Spring web [uses] - com.springsource.slf4j.org.apache.log4j

    My app - [uses] - com.springsource.org.apache.log4j

  6. #6
    Join Date
    Oct 2008
    Location
    Winchester, UK
    Posts
    535

    Default

    So does changing the bundle symbolic name to com.springsource.slf4j.org.apache.log4j fix your problem?
    Glyn Normington
    SpringSource

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •