Bug 62728 - ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSheetsImpl$1SheetList
Summary: ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.i...
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.17-FINAL
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on: 62730
  Show dependency tree
Reported: 2018-09-17 15:08 UTC by Javi
Modified: 2018-09-18 07:57 UTC (History)
0 users

screenshot of the problematic class (25.36 KB, image/png)
2018-09-17 16:16 UTC, Javi

Note You need to log in before you can comment on or make changes to this bug.
Description Javi 2018-09-17 15:08:28 UTC
getSheetList method throws the following exception:

ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSheetsImpl$1SheetList
	at org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSheetsImpl.getSheetList

Checking the decompiled code of the class CTSheetsImpl it is possible to see a strange dependency:
  import org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTSheetsImpl.1SheetList;

That inner class is not there. It looks like the method getSheetList was refactored in version 1.6 and a big part of the code moved to that class that I can not find.
Comment 1 PJ Fanning 2018-09-17 15:23:09 UTC
poi-ooxml-schemas jar only has the main org.openxmlformats classes - use ooxml-schema instead - it has all the org.openxmlformats classes.

Better still, try POI 4.0.0.

[1] https://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas/1.3
Comment 2 Javi 2018-09-17 16:16:12 UTC
Created attachment 36151 [details]
screenshot of the problematic class

What I mean is that in poi-ooxml-schemas jar, the class CTSheetsImpl is not correct and its inner class 1SheetList does not exist in both versions 3.16 and 3.17. Also, I have just checked 4.0 version and it has the problem. 
ooxml-schema 1.3 contains an older implementation of the CTSheetsImpl which is equivalent to the one that you can find in poi-ooxml-schemas 3.15 with is correct.
Comment 3 PJ Fanning 2018-09-17 16:35:42 UTC
There is an ooxml-schemas 1.4 which was released with poi 4.0.0.
ooxml-schemas 1.3 is the jar that poi-ooxml-schemas-3.17 is built from.

getSheetList can be replaced with getSheetArray - the latter method does not need the inner class 1SheetList.

Apache POI code base only seems to use getSheetArray - from a grep that I've just done.
Comment 4 Javi 2018-09-17 16:56:55 UTC
Cool, getSheetArray can solve my problem. Nevertheless, getSheetList method is not correct and that problem should be fixed or the method removed because it is going to be continuously raising that exception.
Comment 5 PJ Fanning 2018-09-17 17:23:36 UTC
org.openxmlformats classes are not part of the POI public API. They are merely implementation classes. If you insist on using them directly, that is up to you - but the POI team are not providing any guarantees for them.
And to reiterate, the 1SheetList inner class is in ooxml-schemas jar.
Comment 6 Andreas Beeker 2018-09-17 18:37:06 UTC
With #56854 we've replaced most (all?) calls to get*List().

As we have now control over XmlBeans, we could do ...
a) ... nothing, because it's in the full schema
b) ... remove the ...List() calls on the schema generation, which probably breaks a lot of user code - so this is a no-go
c) ... analyze and fix the performance problems in XmlBeans, but that wouldn't include the inner classes
d) ... do some reflection magic in the ooxml-lite generation and call all the *List() methods, which makes the ooxml-lite purpose futile
e) ... create test cases for selected *List() methods - which one should we call and why not the others?

so choosing a) or c) doesn't lead to code changes in POI, therefore WONTFIX is correct.