Can you check/try for CTExtensionList as this is in the error-message, not CTExtension, maybe this one is actually missing..
Dominik On Fri, 21 Aug 2020, 15:11 , <[email protected]> wrote: > This is my setup: > Product Version: Apache NetBeans IDE 11.2 > Java: 13.0.1; Java HotSpot(TM) 64-Bit Server VM 13.0.1+9 > Runtime: Java(TM) SE Runtime Environment 13.0.1+9 > System: Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb) > User directory: C:\Users\dbraw\AppData\Roaming\NetBeans\11.2 > Cache directory: C:\Users\dbraw\AppData\Local\NetBeans\Cache\11.2 > > I have added ooxml-xml-schemas-1.4.jar to my classpath to utilize more > advanced spreadsheet functions like setting pivotable datafield number > formats. > > When I try to run my file I get the following exception: > > Traceback (most recent call last): > File > > "C:\Users\dbraw\Documents\NetBeansProjects\TestJython\src\createPivotTable.p > y", line 10, in <module> > from org.openxmlformats.schemas.spreadsheetml.x2006.main import * > java.lang.NoClassDefFoundError: > org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList > at java.lang.Class.getDeclaredMethods0(Native Method) > at java.lang.Class.privateGetDeclaredMethods(Unknown Source) > at java.lang.Class.privateGetPublicMethods(Unknown Source) > at java.lang.Class.getMethods(Unknown Source) > at org.python.core.PyJavaType.init(PyJavaType.java:273) > at org.python.core.PyType.createType(PyType.java:1264) > at org.python.core.PyType.addFromClass(PyType.java:1201) > at org.python.core.PyType.fromClass(PyType.java:1291) > at > > org.python.core.adapter.ClassicPyObjectAdapter$6.adapt(ClassicPyObjectAdapte > r.java:76) > at > > org.python.core.adapter.ExtensiblePyObjectAdapter.adapt(ExtensiblePyObjectAd > apter.java:44) > at > > org.python.core.adapter.ClassicPyObjectAdapter.adapt(ClassicPyObjectAdapter. > java:120) > at org.python.core.Py.java2py(Py.java:1549) > at > org.python.core.PyJavaPackage.addClass(PyJavaPackage.java:89) > at > > org.python.core.packagecache.PackageManager.basicDoDir(PackageManager.java:1 > 07) > at > > org.python.core.packagecache.SysPackageManager.doDir(SysPackageManager.java: > 138) > at > org.python.core.PyJavaPackage.fillDir(PyJavaPackage.java:123) > at org.python.core.imp.importAll(imp.java:1012) > at org.python.core.imp.importAll(imp.java:1000) > at > > org.python.pycode._pyx0.f$0(C:\Users\dbraw\Documents\NetBeansProjects\TestJy > thon\src\createPivotTable.py:91) > at > > org.python.pycode._pyx0.call_function(C:\Users\dbraw\Documents\NetBeansProje > cts\TestJython\src\createPivotTable.py) > at org.python.core.PyTableCode.call(PyTableCode.java:165) > at org.python.core.PyCode.call(PyCode.java:18) > at org.python.core.Py.runCode(Py.java:1261) > at > org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:235) > at org.python.util.jython.run(jython.java:247) > at org.python.util.jython.main(jython.java:129) > Caused by: java.lang.ClassNotFoundException: > org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtensionList > at java.net.URLClassLoader.findClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) > at java.lang.ClassLoader.loadClass(Unknown Source) > ... 26 more > java.lang.NoClassDefFoundError: java.lang.NoClassDefFoundError: > org/openxmlformats/schemas/spreadsheetml/x2006/main/CTExtensionList > > > my code includes the following: > > import sys > from java.lang import System, String > from java.io import BufferedReader, InputStreamReader,FileOutputStream, > FileInputStream, File > from org.apache.poi.xssf.usermodel import * > from org.apache.poi.ss.usermodel import WorkbookFactory, Workbook, > DataFormatter, Cell, DataConsolidateFunction > from org.apache.poi.ss.util import * > from org.apache.poi.ss import * > from java.util import Date > from java.text import DateFormat, SimpleDateFormat > from org.openxmlformats.schemas.spreadsheetml.x2006.main import * > def setFormatDataField(pivotTable,fieldIndx, numFormatId): > pivotTable = pivotTable > index = fieldIndx > fmtId = numFormatId > > > pivotTable.getCTPivotTableDefinition().getDataFields().dataField.getFld(inde > x).dataField.setNumFmtID(FmtId) > return None > > I have confirmed that CTExtension and CTExtensionList exist in the > ooxml-schemas-1.4.jar > > I have also tried explicitly importing the class file, i.e. import > org.openxmlformats.schemas.spreadsheetml.x2006.main.CTExtension (and > CTExtension.class) with the same results. > It is though my compiler cannot see this path??? > The only solutions online refer to adding dependencies to the POM file, but > I am not running Maven or other "plugins". > Please advise. > Regards, > > Dave > > David M Brawner, PMP > 3020 Gant Quarters Cir > Marietta, GA 30068 > 678.545.9171 Mobile > >
