Thank you all for your suggestions. I am using WM 9.10 version. Earlier I was creating a csv file from json but now I need to send an xlsx file. My input is json that I get from calling a third party API. So I have been asked to keep everything same and convert the final csv file to xlsx file and delete the csv file. I want a single java service to do this rather than a combination of flow service and java service to read csv and write xlsx file. For this I am using apache poi for excel and opencsv jar to read csv.
Today I am able to progress on reading the file.
I used Path class from java.nio.file.Paths; package and converted it to path object
Path path = Paths.get(csvFilePath);
csvReader = new CSVReader(new FileReader (path.toString()));
Now I am stuck at writing the excel file.
Workbook workBook = new SXSSFWorkbook();
SXSSFSheet sheet = (SXSSFSheet) workBook.createSheet(“Sheet”);----> giving null pointer exception
This works fine on local and is successfully writing data to xlsx file however on unix filesystem I am getting null pointer exception.
I used Workbook workBook = new XSSFWorkbook();-----> still it didn’t work
but when I used Workbook workBook = new HSSFWorkbook();
it worked and I was able to create xls file on server. However I need xlsx format
As per the suggestion on xlsx - Apache POI SXSSFWorkbook createSheet() return NullPointerException - Stack Overflow
I believe I need to install Microsoft fonts on unix server however network team has put an ACL and I cant install it.
Do you think If I get the approval to install font, it will resolve my issues? Does anybody has any better approach for example script? I am not able to understand why xls file gets created but not xlsx. I have imported all correct jars and classes of apache poi framework.
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;
Thanks in advance
#webMethods#Integration-Server-and-ESB#Flow-and-Java-services