Getting "NoClassDefFoundError" when using the setcelldate | Selenium Forum
M
Posted on 30/10/2015
Getting "NoClassDefFoundError" when using the setcelldate and after this the original file is getting corrupted.

Code:
package poi;

public class Excercise_poi_basics {
public static void main(String[] args) {
Xls_Reader xls=new Xls_Reader("C:\\TEMP\\Login_Info_DB1.xlsx");
int row_count=xls.getRowCount("Login_Info");
int col_count=xls.getColumnCount("Login_Info");
System.out.println("Row count"+row_count);
System.out.println("col_count"+col_count);

for(int i=2;i<=row_count;i++)
{
for(int j=0;j<col_count;j++)
{
System.out.println(xls.getCellData("Login_Info",j,i));
}
}

xls.setCellData("Login_Info", "login", 10, "NewAdd");

}
}


Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTDxfs$1
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs.<clinit>(Unknown Source)
at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$Factory.newInstance(Unknown Source)
at org.apache.poi.xssf.model.StylesTable.writeTo(StylesTable.java:362)
at org.apache.poi.xssf.model.StylesTable.commit(StylesTable.java:377)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:177)
at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:181)
at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:214)
at poi.Xls_Reader.setCellData(Xls_Reader.java:224)
at poi.Excercise_poi_basics.main(Excercise_poi_basics.java:19)
Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$1
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 9 more

M
Replied on 30/10/2015

great q/a about NoClassDefFoundError http://stackoverflow.com/questions/34413/why-am-i-getting-a-noclassdeffounderror-in-java