Problem with RPG reading an Excel file with POI 3.8
Last Post 23 Nov 2012 08:02 AM by Alex R. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Alex R
New Member
New Member
Posts:1

--
23 Nov 2012 08:02 AM

Hi all

I donwloaded the latest version of POI Release Brings Excel's XLSX Support to RPG (3.8) of Scott Klement and all work great!

I nedd only read a multiple Excel spreadsheet but if i try to read for the second time the same file from an interactive session, the program crashes with this  error:

 

Message . . . . :   Java exception received when calling Java method.       
 Cause . . . . . :   RPG procedure SS_OPEN in program mylib/HSSFR4 received
   Java exception "org.apache.poi.POIXMLException:                           
   java.lang.reflect.InvocationTargetException" when calling method "create" 
   with signature                                                            
   "(Ljava.io.InputStream;)Lorg.apache.poi.ss.usermodel.Workbook;" in class  
   "org.apache.poi.ss.usermodel.WorkbookFactory".

 

Here a small code sample:

H DATEDIT(*YMD)                                                                 
     H DFTACTGRP(*NO)                                                                
     H OPTION(*SRCSTMT: *NODEBUGIO: *NOSHOWCPY)                                      
     H THREAD(*SERIALIZE)                                                            
     H BNDDIR('HSSF')                                                                
      ************************************************************************       
      * File specifications                                                          
      ************************************************************************        
                                                                                      
    /copy hssf_h 

    D FileName            C                   Const('/filesinbound/Dummy.xlsx') 

    D book                    s                   like(SSWorkbook)    

    D count                   s             10I 0

/free 

  ss_begin_object_group(100);                        
                                                    
     // Load an existing spreadsheet into memory        
     book = ss_open(FileName);                          
     if (book = *null);                                 
     // ERROR MSG

    endif;                                             
     count = SSWorkbook_getGetNumberOfSheets(book);    

    ss_freelocalref(book);        
    ss_end_object_group();        
    *inlr = *on;

/end-free 

 

 If I run the same program from a SBMJOB everithing works fine. I assume that is something realted to the garbage collector or with the JVM's memory and related threads... but I haven't any other ideas!

Any suggestions?

Thanks

You are not authorized to post a reply.

Acceptable Use Policy