Skip to main content  
        iSeries home   |   Easy400     |   CGIDEV2     |   MMAIL  
Program development
TABLEXLS includexml
Right to left
Scott's demos
Java products
 Questions & Answers

Question and Answers

Answers to some questions asked by HSSFCGI users.

  1. Q: When running command HSSFCGI/TABLEXLS or HSSFCGI/XLSGEN, the following error is displayed:
    1. Escape program message:
      ERROR in executing XLSGEN, see joblog previous messages.
    2. Previous diagnostic message:
      Message . . . . : Java exception received when calling Java method.
      Last cell processed was row 0, column 0 in sheet *Unknown*. Joblog message Java exception received when calling Java method.
      Error RNX0301 in pgm HSSFCGI/XLSGEN_2 module XLSGEN_2 at stmt + 244600:
      "Java exception received when calling Java method."
    3. Additional message information (via F1):
      Message ID . . . . . . : RNX0301 Severity . . . . . . . : 50
      Message type . . . . . : Escape
      Date sent . . . . . . : xx/xx/xx Time sent . . . . . . : xx:xx:xx
      Message . . . . : Java exception received when calling Java method.
      Cause . . . . . : RPG procedure XLSGEN_2 in program HSSFCGI/XLSGEN_2
      received Java exception "java.lang.NoClassDefFoundError:
      org.apache.poi.hssf.usermodel.HSSFWorkbook" when calling method ""
      with signature "()V" in class "org.apache.poi.hssf.usermodel.HSSFWorkbook".
      Recovery . . . : Contact the person responsible for program maintenance to
      determine the cause of the problem.
    What can I do About it?
    A: This is a very common case. The error is that a Java class, needed by service program HSSFCGI/HSSFR4, cannot be found.
    The way a Java class is retrieved by the Java Virtual Machine (JVM) is as follow:
    1. A search is made in IFS directory /QIBM/UserData/Java400/ext. This directory works like a system library list.
    2. If the search is unsuccessful, then the search goes through the IFS directories mentioned in the environment variable CLASSPATH, which works like a job library list.
    One major problem is that once the JVM has been started in a job, the current CLASSPATH is stored in its data, and cannot be changed even by changing the job CLASSPATH. This restriction has the following consequences:
    1. If the job has to process two or more applications using different classes, and each application sets up a different CLASSPATH, only the first application will work, the subsequent ones will fail in retrieving their Java classes.
    2. To overcome this problem, Java application developers often do install their classes in the IFS directory /QIBM/UserData/Java400/ext. In this way, other problems may raise when different applications have classes with the same name, and class methods are different. This may happen when two applications, built over a given Java package (example: POI), require a different release of that package.
      Because of this, Java classes used by HSSFCGI are not in IFS directory /QIBM/UserData/Java400/ext, they are in IFS directory /hssfcgi/java, and HSSFCGI sets up the appropriate CLASSPATH environment variable before calling the JVM.
    Once the above is understood, the ways to solve the NoClassDefFoundError are quite obvious:
    1. Make sure that IFS directory /QIBM/UserData/Java400/ext does not contain any POI-related and any XLPARSE-related objects.
    2. Run command WRKENVVAR(*SYS) and, if system level CLASSPATH environment variable is listed, remove it. Java applications should instead create their own CLASSPATH env.var's.
    3. If your job must execute some other Java applications beside running HSSFCGI commands TABLEXLS and/or XLSGEN, in these HSSFCGI commands specify the parameter SBMJOB(*YES). This parameter submits the execution of the command in a separate batch job and the submitting job waits for the completion of the submitted one.
    See also page JVMSTARTUP.
  2. Q: Is it possible to have a cell text vertically rotated?
    A: Yes, by creating the Excel spreadsheet with some XLSGEN script and using the keyword rotate in tag <data>.
    Example:<data type="Column-Header" rotate="90"> .
  3. Q: When using command TABLEXLS to create an Excel spreadsheet, how can I tell not to generate the first row cells as column headers?
    A: Just specify parameter COLHDGOPT(0) .
  4. Q: How can I tell command TABLEXLS not to generate a cell depending on the contents of the related database field?
    A: Specify parameter SKPFLDS (Skip fields by field test).
  5. Q: Is it possible, using XLSGEN, to generate spreadsheet cells containing drop down lists?
    A: No.