java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlObject Error

前端 未结 6 1744
执笔经年
执笔经年 2020-12-05 00:02

I am getting following error

Exception in thread \"main\" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlObject at OrderBook.WriteToEx

相关标签:
6条回答
  • 2020-12-05 00:15

    I faced a similar situation, so i replaced all the external jar files(poi-bin-3.17-20170915) and make sure you add other jar files present in lib and ooxml-lib folders.

    Hope this helps!!!:)

    0 讨论(0)
  • 2020-12-05 00:17

    You have to include one more jar.

    xmlbeans-2.3.0.jar
    

    Add this and try.

    Note: It is required for the files with .xlsx formats only, not for just .xls formats.

    0 讨论(0)
  • 2020-12-05 00:17

    You need to include xmlbeans-xxx.jar and if you have downloaded the POI binary zip, you will get the xmlbeans-xxx.jar in ooxml-lib folder (eg: \poi-3.11\ooxml-lib)

    This jar is used for XML binding which is applicable for .xlsx files.

    0 讨论(0)
  • 2020-12-05 00:18

    you have to include two more jar files.

    xmlbeans-2.3.0.jar and dom4j-1.6.1.jar Add try it will work.

    Note: It is required for the files with .xlsx formats only, not for just .xlt formats.

    0 讨论(0)
  • 2020-12-05 00:28

    When trying to translate Excel file with .xlsx suffix, you need to add additional jar, xmlbeansxxx.jar. xxxx is version, such as xmlbeans-2.3.0.jar

    0 讨论(0)
  • 2020-12-05 00:33

    For all that you add xmlbeans-2.3.0.jar and it is not working,you must use HSSFWorkbook instead of XSSFWorkbook after add jar.For instance;

        Workbook workbook = new HSSFWorkbook();
        Sheet listSheet = workbook.createSheet("Kişi Listesi");
    
        int rowIndex = 0;
        for (KayitParam kp : kayitList) {
            Row row = listSheet.createRow(rowIndex++);
            int cellIndex = 0;
            row.createCell(cellIndex++).setCellValue(kp.getAd());
            row.createCell(cellIndex++).setCellValue(kp.getSoyad());
            row.createCell(cellIndex++).setCellValue(kp.getEposta());
            row.createCell(cellIndex++).setCellValue(kp.getCinsiyet());
            row.createCell(cellIndex++).setCellValue(kp.getDogumtarihi());
            row.createCell(cellIndex++).setCellValue(kp.getTahsil());
        }
    
        try {
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            workbook.write(baos);
            AMedia amedia = new AMedia("Kisiler.xls", "xls",
                    "application/file", baos.toByteArray());
            Filedownload.save(amedia);
            baos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    
    0 讨论(0)
提交回复
热议问题