Here is what I get when running using the 5.0.0 APIs:
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] at org.apache.poi.ss.usermodel.WorkbookFactory.wp(WorkbookFactory.java:300) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:210) at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:163) Note: It works when running in my IDE; however, when it runs from a (mega) jar (built by ant), we get the exception above. I am wondering if it has something to do how the jar is being built; however, it did/does work with the 4.1.2 jars. Thoughts on where to look? Thank you! --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
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 --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
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 <[hidden email]> 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 > |
On Fri, 5 Feb 2021, Bryan Coleman wrote:
> 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 When merging jars with service files, you need to append the files with the same name together - they contain one class file per line so you need all the lines Nick --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Just wanted to circle back on this issue. With the feedback/explanation, I
was able to merge service files to correct the behavior eradicating the IOException. Thank you! Bryan On Sun, Feb 7, 2021 at 3:07 PM Nick Burch <[hidden email]> wrote: > On Fri, 5 Feb 2021, Bryan Coleman wrote: > > 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 > > When merging jars with service files, you need to append the files with > the same name together - they contain one class file per line so you need > all the lines > > Nick > |
Free forum by Nabble | Edit this page |