Re: Upgrade to 5.0.0 resulted in IOException message

Bryan Coleman <[email protected]>
Newsgroups gmane.comp.jakarta.poi.user
Message-ID <CAFU0Y=q=y9HP6OrFhgiO1rPm1Q9iXVoXycyLuOW6sUjLkKz80Q@mail.gmail.com>
That makes sense.  I am using an ant script to unjar individual jars and
then to create a mega jar from my classes and those APIs.  I am keeping the
services files.  That said, I noticed that both the main poi and the
poi-ooxml jar have services files with the same name; however, different
content.  What is the proper way to include those?  Should I create one
file that contains the content from both (i.e.
org.apache.poi.extractor.MainExtractorFactory,
org.apache.poi.ooxml.extractor.POIXMLExtractorFactory)?

Thank you,

Bryan

On Fri, Feb 5, 2021 at 6:27 AM Nick Burch <[email protected]> wrote:

> On Wed, 3 Feb 2021, Bryan Coleman wrote:
> > java.io.IOException: Your InputStream was neither an OLE2 stream, nor an
> > OOXML stream or you haven't provide the poi-ooxml*.jar in the
> > classpath/modulepath - FileMagic: OLE2, having providers:
> > [org.apache.poi.xssf.usermodel.XSSFWorkbookFactory@40086342]
>
> That's very odd - you have the main POI jar there (need it for
> WorkbookFactory), but somehow have lost the reference to the HSSF classes
> which also live there...
>
> > Note: It works when running in my IDE; however, when it runs from a
> > (mega) jar (built by ant), we get the exception above.
>
> Ah, I suspect something is clobbering some files when it merges stuff into
> a mega jar. My guess is it's the /META-INF/services files, and your mega
> jar is taking just one rather than merging as it needs to
>
> Can you post details of how you're building the mega jar, and/or look up
> how to get the tool/task you're using to merge not overwrite ServiceLoader
> / Java Service Provider Interface services files?
>
> Nick
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.