I developed an OSGI bundle for five jars
poi-3.9 - bundle name:- org.apache.poi
poi-ooxml-3.9- bundle name:- org.apache.poi.ooxml
poi-ooxml-schemas
dom4j
xmlbeans
but when i use these jars it will give an error
NoClassDef found
org.apache.poi.ss.usermodel.WorkbookFactory
Then i realized some packages (like org.apache.poi.ss.usermodel) in
poi-3.9
poi-ooxml-3.9 jars are same
then i use
Require-Bundle:
org.apache.poi;visibility:=reexport,
org.apache.poi.ooxml;visibility:=reexport
It will give an same error What can I do to resolve this problem
Manifest File
Bundle-ManifestVersion: 1
Bundle-Name: poi
Bundle-SymbolicName: org.apache.poi
Bundle-Version: 3.9
Bundle-Vendor: XYZ
Bundle-Localization: plugin
Import-Package: org.apache.poi.ss.usermodel
Export-Package: org.apache.poi,
org.apache.poi.common.usermodel,
org.apache.poi.ddf,
org.apache.poi.dev,
org.apache.poi.hpsf,
org.apache.poi.hpsf.extractor,
org.apache.poi.hpsf.wellknown,
org.apache.poi.hssf,
org.apache.poi.hssf.dev,
org.apache.poi.hssf.eventmodel,
org.apache.poi.hssf.eventusermodel,
org.apache.poi.hssf.eventusermodel.dummyrecord,
org.apache.poi.hssf.extractor,
org.apache.poi.hssf.model,
org.apache.poi.hssf.record,
org.apache.poi.hssf.record.aggregates,
org.apache.poi.hssf.record.cf,
org.apache.poi.hssf.record.chart,
org.apache.poi.hssf.record.common,
org.apache.poi.hssf.record.cont,
org.apache.poi.hssf.record.crypto,
org.apache.poi.hssf.record.pivottable,
org.apache.poi.hssf.usermodel,
org.apache.poi.hssf.util,
org.apache.poi.poifs.common,
org.apache.poi.poifs.crypt,
org.apache.poi.poifs.dev,
org.apache.poi.poifs.eventfilesystem,
org.apache.poi.poifs.filesystem,
org.apache.poi.poifs.nio,
org.apache.poi.poifs.property,
org.apache.poi.poifs.storage,
org.apache.poi.ss,
org.apache.poi.ss.extractor,
org.apache.poi.ss.format,
org.apache.poi.ss.formula,
org.apache.poi.ss.formula.atp,
org.apache.poi.ss.formula.constant,
org.apache.poi.ss.formula.eval,
org.apache.poi.ss.formula.eval.forked,
org.apache.poi.ss.formula.function,
org.apache.poi.ss.formula.functions,
org.apache.poi.ss.formula.ptg,
org.apache.poi.ss.formula.udf,
org.apache.poi.ss.usermodel,
org.apache.poi.ss.usermodel.charts,
org.apache.poi.ss.util,
org.apache.poi.ss.util.cellwalk,`enter code here`
org.apache.poi.util
Second Manifest
Bundle-ManifestVersion: 1
Bundle-Name: poi.ooxml
Bundle-SymbolicName: org.apache.poi.ooxml
Bundle-Version: 3.9
Bundle-Vendor: xyz
Bundle-Localization: plugin
Require-Bundle: org.apache.poi.ooxml.schemas,
org.apache.poi.dom4j,
org.apache.poi.xmlbeans
Import-Package: org.apache.poi.ss.usermodel
Export-Package: org.apache.poi,
org.apache.poi.dev,
org.apache.poi.extractor,
org.apache.poi.openxml4j.exceptions,
org.apache.poi.openxml4j.opc,
org.apache.poi.openxml4j.opc.internal,
org.apache.poi.openxml4j.opc.internal.marshallers,
org.apache.poi.openxml4j.opc.internal.signature,
org.apache.poi.openxml4j.opc.internal.unmarshallers,
org.apache.poi.openxml4j.opc.signature,
org.apache.poi.openxml4j.util,
org.apache.poi.ss.usermodel,
org.apache.poi.util,
org.apache.poi.xslf,
org.apache.poi.xslf.extractor,
org.apache.poi.xslf.model,
org.apache.poi.xslf.model.geom,
org.apache.poi.xslf.usermodel,
org.apache.poi.xslf.util,
org.apache.poi.xssf.dev,
org.apache.poi.xssf.eventusermodel,
org.apache.poi.xssf.extractor,
org.apache.poi.xssf.model,
org.apache.poi.xssf.streaming,
org.apache.poi.xssf.usermodel,
org.apache.poi.xssf.usermodel.charts,
org.apache.poi.xssf.usermodel.extensions,
org.apache.poi.xssf.usermodel.helpers,
org.apache.poi.xssf.util,
org.apache.poi.xwpf.extractor,
org.apache.poi.xwpf.model,
org.apache.poi.xwpf.usermodel
First of all: do you really need to convert the poi jars into bundles? If you use the code from only one other bundle, it may be wise to just include the jars into that bundle and adapt the bundle class path accordingly. This may save you a lot of problems, especially if you are not very familiar with converting existing jars to OSGi bundles.
I had a quick look at the poi distribution and the packages may be named the same, but the contents are not the same (split packages). This means that the simplest option here is to create a new bundle jar including all the classes from the poi and poi-ooxml jars from the distribution. Then export all packages from that bundle using the Export-Package
header.