Search code examples
file-uploadosgiapache-felixapache-karafosgi-bundle

Apache Commons FileUpload OSGi bundle


I got this error installing my bundle in Karaf, I am new to OSGi and Karaf so I can use some help in interpreting the error.

Error executing command: Could not start bundle mvn:com.myexample/foobar/0.1.0.SNAPSHOT 
in feature(s) com.myexample.foobar-0.6.0.SNAPSHOT: Unresolved constraint in bundle 
com.myexample.foobar [102]: Unable to resolve 102.0: missing requirement [102.0] 
osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.fileupload)
(version>=1.3.0)(!(version>=2.0.0)))

This is in my feature.xml

    <bundle>mvn:commons-fileupload/commons-fileupload/1.3</bundle>

and in my POM

  <dependency>
     <groupId>commons-fileupload</groupId>
     <artifactId>commons-fileupload</artifactId>
     <version>1.3</version>
  </dependency>

The Maven repository shows the latest version at 1.3 but it may not be the OSGi version if there is one, anyone know where I can find it? I also tried wrap:mvn and that didn't work either.


Solution

  • 1.3 has an OSGi manifest and should work as a bundle:

    $ bnd print -i http://repo1.maven.org/maven2/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar
    [IMPEXP]
    Import-Package
      javax.servlet                          
      javax.servlet.http                     
      org.apache.commons.io                  
      org.apache.commons.io.output           
    
    Export-Package
      org.apache.commons.fileupload          {version=1.3}
      org.apache.commons.fileupload.disk     {version=1.3}
      org.apache.commons.fileupload.portlet  {version=1.3}
      org.apache.commons.fileupload.servlet  {version=1.3}
      org.apache.commons.fileupload.util     {version=1.3}