gpt4 book ai didi

java - 如何将 org.apache.poi 添加到 Karafa

转载 作者:行者123 更新时间:2023-12-01 09:49:39 27 4
gpt4 key购买 nike

如何在项目中添加依赖? OSGI+POI在执行时这段代码

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

Workbook wb = WorkbookFactory.create(originalStream);

执行此代码后,抛出错误

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

我的pom.xml添加依赖

<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>

安装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

Karaf 中的所有 bundle 均成功安装并运行

最佳答案

亚历山大·卡塔帕尼斯,你是对的

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

谢谢大家。

关于java - 如何将 org.apache.poi 添加到 Karafa,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37683119/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com