IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Getting Null pointer exception while trying to create xlsx file on unix

  • 1.  Getting Null pointer exception while trying to create xlsx file on unix

    Posted Sat November 14, 2020 06:22 AM

    Hi All,

    I have a requirement to convert csv file to excel (xlsx format). I am using WM 9.10 and have written a java service and used Apache poi framework for same. I am able to create xlsx file on local using test harness service but on server I get Null pointer exception. If I try to create xls file on server it gets created with no issue.

    Below are the imports I have used:

    import org.apache.poi.xssf.usermodel.*;
    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.ss.usermodel.CreationHelper;
    import org.apache.poi.ss.usermodel.Row;
    import org.apache.poi.ss.usermodel.Workbook;
    import org.apache.poi.ss.usermodel.Sheet;
    import org.apache.poi.xssf.streaming.SXSSFSheet;
    import org.apache.poi.xssf.streaming.SXSSFWorkbook;

    If I use below code, it gives me null pointer exception only on server but works fine on local
    Workbook workBook = new SXSSFWorkbook();
    SXSSFSheet sheet = (SXSSFSheet) workBook.createSheet(“Sheet”);

    but if I use
    Workbook workBook = new HSSFWorkbook();
    Sheet sheet = (SXSSFSheet) workBook.createSheet(“Sheet”);
    then I don’t get any issue and file gets created on server as well as on local.

    How to check if our filesystem supports xlsx format as I believe an issue with code would have been caught in local testing as well.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 2.  RE: Getting Null pointer exception while trying to create xlsx file on unix

    Posted Fri March 26, 2021 01:14 PM

    If you want help with this kind of problem, it would be useful to post a copy of your java service and the stack trace of the error.

    I hope you managed to solve your problem and we are actively try to make sure you get timely response in the future, so please come back and share your issues with is.

    regards
    John.
    Product Manager
    Integration & Microservice Runtime


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods