Bug 35110 - unable to open .xls on AS/400 in RPGLE program...
Summary: unable to open .xls on AS/400 in RPGLE program...
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: All other
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2005-05-27 21:19 UTC by Shane Cessna
Modified: 2005-05-30 03:59 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Shane Cessna 2005-05-27 21:19:35 UTC
When I try to open a .xls file on the IFS of my company's AS/400, I always get
an exception thrown...when I call this job, I set the CLASSPATH variable to the
folder on the IFS where the poi-2.5.1-final-20040804.jar file is...this is what
the job log says in regards to the failure:

Message . . . . :   Java exception received when calling Java method.         
Cause . . . . . :   RPG procedure HSSF_OPEN in program ASCLIB/HSSFR4 received 
  Java exception "java.io.IOException:" when calling method "<init>" with     
  signature "(Ljava.io.InputStream;)V" in class                               
  "org.apache.poi.poifs.filesystem.POIFSFileSystem". Recovery  . . . :        
  Contact the person responsible for program maintenance to determine the     
  cause of the problem. Technical description . . . . . . . . :   If the      
  exception indicates that the Java class was not found, ensure the class for 
  the method is in the class path. If the exception indicates that the Java   
  method was not found, check the method name and signature. If the signature 
  is not correct, change the RPG prototype for the method, or change the Java 
  method, so that the return type and parameter types match. You can determine
  the signatures for all the methods in class XYZ using command QSH CMD('javap
  -s XYZ').                                                                   

this is the routine that's failing...

 *  hssf_open():  Open an existing HSSF Workbook                  
 *     peFilename = IFS path/filename of workbook to open         
 *  Returns the HSSFWorkbook object opened                        
P hssf_open       B                   EXPORT                      
D hssf_open       PI                  like(HSSFWorkbook)          
D   peFilename                1024A   const varying               
D jFileInputStream...                                             
D                 S               O   CLASS(*JAVA                 
D                                     : 'java.io.FileInputStream')
D jInputStream...                                                 
D                 S               O   CLASS(*JAVA                 
D                                     : 'java.io.InputStream')     
D POIFSFilesystem...                                               
D                 S               O   CLASS(*JAVA                  
D                                     : 'org.apache.poi.poifs-     
D                                     .filesystem.POIFSFileSystem')
D new_FileInputStream...                                           
D                 pr              O   extproc(*JAVA                
D                                     :'java.io.FileInputStream'   
D                                     : *CONSTRUCTOR)              
D                                     CLASS(*JAVA:                 
D                                     'java.io.FileInputStream')   
D  filename                           like(jString) const          
D new_POIFSFileSystem...                                           
D                 pr              O   extproc(*JAVA                  
D                                     :'org.apache.poi.poifs-        
D                                     .filesystem.POIFSFileSystem'   
D                                     : *CONSTRUCTOR)                
D                                     CLASS(*JAVA:                   
D                                     'org.apache.poi.poifs-         
D                                     .filesystem.POIFSFileSystem')  
D  stream                             like(jInputStream)             
D new_HSSFWorkbookFromPOIFS...                                       
D                 PR                  like(HSSFWorkbook)             
D                                     ExtProc(*JAVA:                 
D                                     'org.apache.poi.hssf.usermodel-
D                                     .HSSFWorkbook':                
D                                     *CONSTRUCTOR)                  
D  poifs                              like(POIFSFileSystem)          
D closeFile       PR                  EXTPROC(*JAVA             
D                                     :'java.io.FileInputStream'
D                                     :'close')                 
D wwStr           s                   like(jString)             
D wwFile          s                   like(jFileInputStream)    
D wwPOIFS         s                   like(POIFSFileSystem)     
D wwBook          s                   like(HSSFWorkbook)        
    wwStr   = new_String(peFilename);                           
    wwFile  = new_FileInputStream(wwStr);                       
    wwPOIFS = new_POIFSFileSystem(wwFile);                      
    wwBook  = new_HSSFWorkbookFromPOIFS(wwPOIFS);               
    return wwBook;             
P                 E            

if you guys can give me any insight to what might be going wrong, I'd appreciate
it...if you need more info or whatever, feel free to shoot me an email...


Comment 1 Avik Sengupta 2005-05-30 11:59:18 UTC
Well, you will not find too many people here willing to debug an AS/400 :). I
can only provide some pointers to troubleshooting

1. First see if the file in question is being opened by POI correctly in a
standalone java program. If yes, its an issue in your environment, and we cant
help you much. If not, please reopen this bug with the erroneous file attached. 

2. See if you can increase log levels to find out the java stack trace. Most
likely, the IO exception is coz the file cannot be found?

3. Has the file been corrupted on transferring to an AS/400? Has it been re-encoded?