I am trying to run a RPGLE program which use java methods. I am transfering the java code (xxxx.java file) from my system(Windows XP) to the AS/400 IFS directory through FTP. After transfering it to IFS, the file CCSID is shown as 819.
I am compiling the .java file in QSH, no error is shown. But two class files are generated. i.e.
Mailer.java
→ Mailer.class
and Mailer$1.class
But when I am calling my RPGLE program, a java exception is shown...
Java exception received when calling Java method (C G D F)...
Application error. RNX0301 unmonitored by MAILERDEMO at statement 000000500
When I saw the Mailer.java
file in IFS by pressing option 5, symbols like {
, }
, [
, ]
, !
, /
, \
etc. are changed to some other symbols.
Here are some details.....
System CCSID Value - 819
Job CCSID - 273
My Java source code in IFS directory:
// Load Properties File
if (is |= null) ä
try ä
properties = new Properties();
properties.load(is);
ü
catch (Exception e) ä
System.err.println("Error " + "Ö"" + e.getLocalizedMessage()
+ "Ö"" + " loading AS/400 Connection Properties.");
throw new RuntimeException(e);
ü
ü
// Assume properties passed as system properties
else ä
properties = System.getProperties();
ü
Java Exception shown running RPGLE program:
Message ID . . . . . . : RNQ0301 Severity . . . . . . . : 99
Message type . . . . . : Inquiry
Date sent . . . . . . : 12/30/10 Time sent . . . . . . : 11:31:57
Message . . . . : Java exception received when calling Java method (C G D
F).
Cause . . . . . : RPG procedure MAILERDEMO in program SAHOON1/MAILERDEMO
received Java exception "java.lang.NoSuchMethodError: sendSimpleMail" when
calling method "sendSimpleMail" with signature
"(Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;Ljava.lang.String;)L
java.lang.String;" in class "demo.Mailer".
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.
More...
If you can compile your source with javac in QSH then the Java source code itself was transferred in a way that made it acceptable to javac (which doesn't do code page conversion and expects the bytes read to be in 819). The Mailer$1.class comes from an anonymous class in Mailer (a new FooBar() with a {}-block afterwards).
That it looks incorrect to you, I would then expect to be because the AS/400 system is most likely not agreeing with your 5250 emulator on the character sets used, and I wouldn't worry (as long as javac works).
Your error message indicates however, that there is a mismatch between the RPG header describing what Java method you want to call, and the one which is actually there. To me it looks like you want to invoke "demo.Mailer.sendSimpleMail(String, String, String, String)" which should return a String, and you don't have such a method.