So, I'm trying to use Pax Logging in a bundle:

        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-api</artifactId>
            <version>${pax.logging.version}</version>
        </dependency>
        <dependency>
            <groupId>org.ops4j.pax.logging</groupId>
            <artifactId>pax-logging-service</artifactId>
            <version>${pax.logging.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

When I do, I get:

ERROR: Bundle org.ops4j.pax.logging.pax-logging-service [5] Error starting
jar:f
ile:/[path_to_main]/main/target/main-1.0.0-SNAPSHOT.jar!/bundle/pax-logging
-service-1.6.9.jar (org.osgi.framework.BundleException: Unresolved
constraint in
 bundle org.ops4j.pax.logging.pax-logging-service [5]: Unable to resolve
5.7: mi
ssing requirement [5.7] osgi.wiring.package;
(&(osgi.wiring.package=org.osgi.ser
vice.cm)(version>=1.0.0)(!(version>=2.0.0))))
org.osgi.framework.BundleException: Unresolved constraint in bundle
org.ops4j.pa
x.logging.pax-logging-service [5]: Unable to resolve 5.7: missing
requirement [5
.7] osgi.wiring.package; (&(osgi.wiring.package=org.osgi.service.cm
)(version>=1.
0.0)(!(version>=2.0.0)))
        at
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:382
6)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)
        at
org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)

        at
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStart
LevelImpl.java:295)
        at java.lang.Thread.run(Unknown Source)

Okay, so if I'm reading that properly it needs org.osgi.service.cm with a
version between 1.0.0 and 2.0.0. Now, the pax-logging-service is obviously
not my bundle, so I can't really fiddle with it, and that version is kind
of interesting as org.osgi.compendium is at something like 4.3.0, so I try
to resolve it by adding the following stuff to MY BUNDLE's pom:

        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.compendium</artifactId>
            <version>1.4.0</version>
        </dependency>

and

                        <Import-Package>
                            *,
                            org.osgi.service.cm; version="[1.3,2.0)"
                        </Import-Package>

Unfortunately, I'm left with the same error. I'm not sure what I'm doing
wrong here. Using Pax logging should be doable as it appears Apache Karafe
is doing so just fine. Any help would be greatly appreciated.

Cheers

Reply via email to