java - OSGI org.slf4j.impl dependency -
i'm new osgi (sorry) , having few issues trying deploy package , related dependencies.
this pom:
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.felix.test</groupid> <artifactid>com.felix.test</artifactid> <version>1.0-snapshot</version> <packaging>bundle</packaging> <dependencies> <dependency> <groupid>org.apache.felix</groupid> <artifactid>org.osgi.core</artifactid> <version>1.0.0</version> <scope>provided</scope> </dependency> <dependency> <groupid>javax.servlet</groupid> <artifactid>servlet-api</artifactid> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.felix</groupid> <artifactid>org.apache.felix.scr.annotations</artifactid> <version>1.9.6</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.apache.httpcomponents</groupid> <artifactid>httpclient</artifactid> <version>4.5</version> <scope>provided</scope> </dependency> <dependency> <groupid>net.sf.ehcache</groupid> <artifactid>ehcache</artifactid> <version>2.10.0</version> </dependency> <dependency> <groupid>org.apache.commons</groupid> <artifactid>commons-lang3</artifactid> <version>3.4</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> <plugin> <groupid>org.apache.felix</groupid> <artifactid>maven-bundle-plugin</artifactid> <version>2.5.4</version> <extensions>true</extensions> <configuration> <instructions> <export-package> com.felix.test.search </export-package> <bundle-symbolicname> ${project.artifactid} </bundle-symbolicname> <bundle-activator> com.felix.test.activator </bundle-activator> </instructions> </configuration> </plugin> </plugins> </build> </project>
then i'm bundling using maven command:
mvn org.apache.felix:maven-bundle-plugin:bundleall
this successful , generates bundle 3 dependency bundles:
- net.sf.ehcache_2.10.0.jar
- org.apache.commons.lang3_3.4.0.jar
- slf4j.api_1.7.7.jar
this seems ok , can install , start first 2 when try , start slf4j following exception:
org.osgi.framework.bundleexception: unable resolve slf4j.api [25](r 25.0): missing requirement [slf4j.api [25](r 25.0)] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0)) unresolved requirements: [[slf4j.api [25](r 25.0)] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0))]
i'm pretty sure i'm missing simple can't pin down. appreciated!
slf4j has unusual design (some might bad design, ahem). api bundle depends on implementation package, namely org.slf4j.impl
.
you need install additional bundle implements slf4j api. there lots of choices here... example slf4j-simple
basic implementation, whereas slf4j-jdk14
uses java 1.4 java.util.logging
end, etc.
logback contains implementation of api.
Comments
Post a Comment