× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



That's the answer, I was certain that I tried logging off and back on again after I bombed it the first time, but I must still have had an environment error in there and fixed it after I signed off and signed back on.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


-----Scott Klement <midrange-l@xxxxxxxxxxxxxxxx> wrote: -----
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx>
Date: 06/26/2015 02:20PM
Subject: Re: Class Not Found

Mark,

It's important when calling Java from RPG that the CLASSPATH be set
before any Java is used in the job. It only reads this environment
variable once -- and that's done the first time any Java is used for the
entire job.

So if you are running this interactively sign off and back on again.
Then set the CLASSPATH, then try the program again so that you know it's
the first time it's used in the job.

Other than that, I don't see why your example wouldn't work.

-SK


On 6/26/2015 12:53 PM, Mark Murphy/STAR BASE Consulting Inc. wrote:
I am having trouble with Scott Klements POI examples, specifically it can't find the HSSFWorkbook class.

Here's my classpath (i know it is short, but the class in question should be found at least)

Display Environment Var (*JOB)

Name . . . . . . . . . : CLASSPATH


Value . . . . . . . . . : '/java/poi-3.11/poi-3.11-20141221.jar'

(I know there are a lot of things missing, but this one jar should contain the class I am looking for right now).

Here is the error:

Additional Message Information

Message ID . . . . . . : RNQ0301 Severity . . . . . . . : 99
Message type . . . . . : Inquiry
Date sent . . . . . . : 06/26/15 Time sent . . . . . . : 12:18:43

Message . . . . : Java exception received when calling Java method (C G D
F).
Cause . . . . . : RPG procedure XLCRTDEMO in program POI36/XLCRTDEMO
received Java exception "java.lang.NoClassDefFoundError:
org.apache.poi.hssf.usermodel.HSSFWorkbook" when calling method "<init>"
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.
Possible choices for replying to message . . . . . . . . . . . . . . . :
D -- Obtain RPG formatted dump.
S -- Obtain system dump.
G -- Continue processing at *GETIN.
C -- Cancel.
F -- Obtain full formatted dump.
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').

Class not found, but this is a partial listing of /java/poi-3.11/poi-3.11-20141221.jar:
48842 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFSheet.class
8073 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFSheetConditionalFormatting.class
8574 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFSimpleShape.class
8258 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFTextbox.class
1623 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFWorkbook$SheetRecordCollector.class
45991 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HSSFWorkbook.class <<<<<
2622 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HeaderFooter$MarkupTag.class
4946 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/usermodel/HeaderFooter.class
3404 Wed Dec 17 01:02:58 EST 2014 org/apache/poi/hssf/usermodel/StaticFontMetrics.class
729 Wed Dec 17 01:02:58 EST 2014 org/apache/poi/hssf/util/AreaReference.class
656 Wed Dec 17 01:02:58 EST 2014 org/apache/poi/hssf/util/CellRangeAddress.class
2030 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/util/CellRangeAddress8Bit.class
1108 Wed Dec 17 01:02:58 EST 2014 org/apache/poi/hssf/util/CellRangeAddressList.class
841 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/util/CellReference.class
3248 Wed Dec 17 01:02:58 EST 2014 org/apache/poi/hssf/util/HSSFCellUtil.class
845 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/util/HSSFColor$AQUA.class
1013 Wed Dec 17 01:02:56 EST 2014 org/apache/poi/hssf/util/HSSFColor$AUTOMATIC.class

The class is obviously there.

I did the following in QShell, this is a partial list of environment variables
OSTYPE=os400
MACHTYPE=powerpc-ibm-os400
CLASSPATH=/java/poi-3.11/poi-3.11-20141221.jar <<<< This is the whole classpath for this session
TERMINAL_TYPE=5250
PATH=/usr/bin:.:/QOpenSys/usr/bin

Yet I get the following error:
$
javap -s org.apache.poi.hssf.usermodel.HSSFWorkbook
ERROR:Could not find org.apache.poi.hssf.usermodel.HSSFWorkbook

and here is what that directory looks like:
$
cd /java/poi-3.11
$
ls
poi-3.11-20141221.jar
$

How do I coerce java to find the class? In qshell and RPG.


Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.