How to add org.apache.poi to Karafa

how to add a dependency in the project? OSGI+POI At execution time this code

import org.apache.poi.ss.usermodel.WorkbookFactory

Workbook wb = WorkbookFactory.create(originalStream);

After execute this code, throws error

Method threw 'java.lang.ClassNotFoundException' exception.
org.apache.poi.ss.usermodel.WorkbookFactory not found by wrap_mvn_org.apache.poi_poi_3.11 [761]

My pom.xml add dependency

<dependency>
     <groupId>org.apache.poi</groupId>
     <artifactId>poi-ooxml-schemas</artifactId>
     <version>3.11</version>
</dependency>
<dependency>
      <groupId>org.apache.xmlbeans</groupId>
      <artifactId>xmlbeans</artifactId>
      <version>2.6.0</version>
</dependency>
<dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>ooxml-schemas</artifactId>
      <version>1.1</version>
</dependency>
<dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi</artifactId>
      <version>3.11</version>
</dependency>
<dependency>
      <groupId>org.apache.poi</groupId>
      <artifactId>poi-ooxml</artifactId>
      <version>3.11</version>
</dependency>

            <plugin> 
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>

            <version>${maven-bundle-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                   <DynamicImport-Package>*</DynamicImport-Package>
                 </instructions>
           </configuration>
        </plugin>

Install bandle karaf:

bundle:install wrap:mvn:org.apache.poi/poi/3.11
bundle:install wrap:mvn:org.apache.poi/poi-ooxml/3.11
bundle:install wrap:mvn:org.apache.poi/poi-ooxml-schemas/3.11
bundle:install wrap:mvn:org.apache.poi/ooxml-schemas/1.1  

All bundles in Karaf successful install and run

Upvotes: 0

Views: 386

Answers (1)

Alexandre Cartapanis you were right

Maybe you should use the osgi bundle of poi provided by servicemix (org.apache.servicemix.bundles/org.apache.servicemix.bundles‌​.poi/3.14_1)

Thanks to all.

Upvotes: 1

Related Questions