Bug 66791 - getting java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER
Summary: getting java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: POIFS (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-25 10:11 UTC by Srinivas
Modified: 2023-08-01 08:27 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srinivas 2023-07-25 10:11:04 UTC
while creating excel document using poi 3.17 library, getting below error

tack Trace java.lang.NoSuchFieldError: RAW_XML_FILE_HEADER
	at org.apache.poi.poifs.filesystem.FileMagic.<clinit>(FileMagic.java:42)
	at org.apache.poi.openxml4j.opc.internal.ZipHelper.openZipStream(ZipHelper.java:208)
	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:98)
	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:324)
	at org.apache.poi.util.PackageHelper.open(PackageHelper.java:37)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:295)

I have added all the below libraries to my classpath:
ooxml-schemas-1.3.jar
poi-3.17.jar
poi-ooxml_schemas-3.17.jar
commons-codec-1.10.jar
commons-logging-1.2.jar
commons-collections4-4.1.jar
curvesapi-1.04.jar
Comment 1 PJ Fanning 2023-07-25 10:15:05 UTC
do you have poi-ooxml-3.17.jar on your classpath?
Comment 2 Srinivas 2023-07-25 10:23:17 UTC
Yes, poi-ooxml-3.17.jar was added to my classpath
Comment 3 PJ Fanning 2023-07-25 10:35:46 UTC
POI 3.17 is 6 years old. It is no longer supported.

This sort of problem with NoSuchFieldError is most commonly caused by users having multiple conflicting copies of the same jar(s) on their classpaths.
Comment 4 Srinivas 2023-07-25 10:52:54 UTC
I have checked multiple times my classpath and I do not see any duplicates, is there any other thing I can check on this?

Thanks for you quick responses.
Comment 5 Nick Burch 2023-07-25 11:47:25 UTC
https://poi.apache.org/help/faq.html has some code you can use to track down additional POI jars files you may have forgotten about
Comment 6 Dominik Stadler 2023-08-01 08:27:51 UTC
This is very likely a problem with the local environment and different versions of some jar/class-files, so we likely cannot "fix" anything here. 

Please reopen with more information and a standalone reproducing code-sample if you are confident it is an actual problem in Apache POI itself.