Announcement Announcement Module
Collapse
No announcement yet.
Import-Package conflict with apache.commons.logging Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Import-Package conflict with apache.commons.logging

    Hello,

    I face a problem with conflicts between org.springframework.spring library import and the bundle import of com.springsource.org.apache.commons.logging.

    To demonstrate the conflict, I added the Bundle-Import Header to the "Hello" Demo from SpringOne:

    Manifest-Version: 1.0
    Bundle-Name: Hello Service Implementation - German
    Bundle-ManifestVersion: 2
    Bundle-SymbolicName: hello.service.impl-de
    Bundle-Version: 1.0.0
    Import-Package: hello.domain, hello.service,
    javax.annotation,
    org.apache.log4j
    Import-Library: org.springframework.spring
    Import-Bundle: com.springsource.org.apache.commons.logging

    When I try to deploy this, I get the following message. Since there is no commons.logging bundle within the library, I have no idea what might be the reason for that.

    Here is the error-log:

    [2008-07-11 14:52:48.263] ion(567)-195.141.221.159 <SPDE0018E> Unable to install application from location 'file:/C:/spring_tools/apps/springsource-ap-1.0.0.beta9/stage/hello.service.impl-de.jar/'. Could not satisfy constraints for bundle 'hello.service.impl-de' at version '1.0.0'.
    Cannot resolve: hello.service.impl-de
    Resolver report:
    Bundle: hello.service.impl-de_1.0.0 - Uses Conflict: Import-Package: org.springframework.beans.factory.support; version="2.5.5.A"
    Possible Supplier: org.springframework.beans_2.5.5.A - Export-Package: org.springframework.beans.factory.support; version="2.5.5.A"
    Possible Conflicts: org.springframework.core,org.apache.commons.loggin g,net.sf.cglib.proxy,org.springframework.util,org. springframework.core.io,org.springframework.beans, org.springframework.core.io.support,org.springfram ework.beans.factory.config,org.springframework.bea ns.factory
    .
    [2008-07-11 14:52:48.287] ion(567)-195.141.221.159 <SPDE0011E> Deployment of 'hello.service.impl-de.jar' version '0' failed.


    Any suggestions, what I am doing wrong or what might be the problem?

    Kind regards,
    André Schäfer (namics AG)

  • #2
    Import-Package conflict with apache.commons.logging

    What version of S2AP is this ?

    Comment


    • #3
      Import-Package conflict with apache.commons.logging

      Hi André,

      To use Log4J and Commons Logging in OSGi, you should actually use the SLF4J implementations.
      Note that Commons Logging is already made available via SLF4J via the
      com.springsource.slf4j.org.apache.commons.logging-1.5.0.jar JAR which you can find in
      PLATFORM_HOME/lib.

      Long story, short: do not import the Commons Logging bundle. Rather, just import the
      packages: org.apache.commons.logging,org.apache.commons.logg ing.impl

      Hope this clears up the issue for you.

      - Sam

      Comment


      • #4
        Import-Package conflict with apache.commons.logging

        Importing the packages worked, thank you very much.

        Comment


        • #5
          Import-Package conflict with apache.commons.logging

          When we say it "works" are we saying that this technique will allow us to write to our own log files? I did a similar thing, but it is only logging to the "trace.log" file. is there any way to get messages logged to my own files?

          Thanks

          Comment


          • #6
            Import-Package conflict with apache.commons.logging

            Hi Carlos,

            You are free to use Log4J and Commons Logging APIs in your application code; however, the Platform uses SL4FJ to route the log output to a per-application trace.log file. You can find detailed information on how this works and how to configure it for your application in the User Guide here:

            http://static.springsource.com/projects/applicationplatform/1.0.x/user-guide/html/ch05s02.html#serviceability-info-trace-app

            > is there any way to get messages logged to my own files?

            As described in the User Guide, your log messages will get written to a location such as
            $PLATFORM_HOME/serviceability/trace/com.myapp-1/, assuming your application's Bundle-SymbolicName is com.myapp and version is 1. So in that regard, the answer to your question is "yes"; however, you can not currently configure the Platform to route your per-application log messages to a user-defined location.

            Hope this helps,

            Sam

            Comment


            • #7
              Import-Package conflict with apache.commons.logging

              Thanks

              Comment

              Working...
              X