Troubleshooting
Problem
This document explains why the following message is issued: RNX0301 - NoSuchMethodError when RPG calls Java™.
Resolving The Problem
If your RPG program calls a Java™ method and the call fails with message RNX0301 indicating that the Java error was NoSuchMethodError, the problem is most likely because of one of the following problems:
|
1 |
The method name does not match the Java method name. If the method name is 'myMethod', the RPG prototype must use 'myMethod' for the method name. It cannot use 'MyMethod' or 'mymethod'. |
| 2 | The STATIC keyword is not specified correctly for the RPG prototype. If the Java method has the static keyword, the RPG prototype must have the STATIC keyword. If the Java method does not have the static keyword, the RPG prototype must not have the STATIC keyword. Following are some examples of Java methods with the static keyword: o static void method1(int i) o public static int method2(byte b[]) |
| 3 | The Java method is a constructor, and the special name *CONSTRUCTOR is not specified for the method name on the RPG prototype. |
| 4 | The return value or the parameters does not match the Java method. Consult the ILE RPG Programmer's Guide to see the mapping between the Java types and the RPG types. You could also use the Java prototype wizard while editing RPGLE source in the IBM Rational Developer for i |
| 5 |
The Java method requires a later Java version than the JVM is using.
This command must be run before the JVM is started.
Set the JAVA_HOME environment variable prior to any Java calls in the job. For example to set to JDK 1.8 use:
ADDENVVAR ENVVAR(JAVA_HOME) VALUE('/QOpenSys/QIBM/ProdData/JavaVM/jdk80/64bit')
|
| 6 | The Java class is still being developed, and the method was added to the Java class after the JVM was started. Java does not pick up any changes to Java methods after the JVM has started. You must end the job (sign off) and start a new job (sign on) for the changes to take effect. |
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CH5AAM","label":"Java Development Kit"},{"code":"a8m0z0000000CHtAAM","label":"Programming ILE Languages"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
478255047
Was this topic helpful?
Document Information
Modified date:
19 November 2024
UID
nas8N1013862