2

So I got a request converting xls to xlsx. After a few hours of researching all sites and solutions I managed to adapt some code i found on various site... Now I am stuck with a java.lang.NoClassDefFoundError: org/apache/log4j/Logger

here is a list all my libs i am using to get this working so far, I had to add a few libs just to get this far and now i am stuck.

dropbox-core-sdk-1.7.7,
itextpdf-5.3.0,
jackson-core-2.2.4,
PDFBox-0.7.3,
poi-3.10-FINAL-20140208,
poi-ooxml-3.5-beta5,
poi-ooxml-schemas-3.10-beta1,
rs2xml,
slf4j-api-1.7.5,
sqlite,
sqlite-jdbc-3.8.7,
xmlbeans

Below is my code where i call he class

private void exportRepBtnActionPerformed(java.awt.event.ActionEvent evt) {                                             
    connect();       
    exportRepairReport();
    // This is where I am trying to convert the xls file
    convertExcelFiles.convertWorkbookHSSFToXSSF(workbook);
    //
    int selectedOption = JOptionPane.showConfirmDialog(null,
            "Generate Comprehensive Report?",
            "OPTIONAL",
            JOptionPane.YES_NO_OPTION);

    if (selectedOption == JOptionPane.YES_OPTION) {
        exportRawRepairs();
    }

} 

Hers is the class where things go south.

public static XSSFWorkbook convertWorkbookHSSFToXSSF(HSSFWorkbook source) 
{
    XSSFWorkbook retVal = new XSSFWorkbook();
        for (int i = 0; i < source.getNumberOfSheets(); i++) 
        {
            XSSFSheet xssfSheet = retVal.createSheet();
            HSSFSheet hssfsheet = source.getSheetAt(i);
            copySheets(hssfsheet, xssfSheet);
        }
    return retVal;
}

Any help will be appreciated, let me know if you need more info.

Thanks in advance.

3

2 Answers 2

4

You have to add the log4j<version>.jar to your classpath.

1

You should add log4j.jar to your classpath

Not the answer you're looking for? Browse other questions tagged or ask your own question.