|
I am having a weird problem with an RPG program calling a Java program. When I call the Java program from the RPG, I get an error that was traditionally thrown when the Java program was compiled using a newer JDK than the JRE running the program. this exception is: Cause . . . . . : RPG procedure CRD002RTST in program MSILVERS/CRD002RTST received Java exception "java.lang.NoSuchMethodError: append (Ljava/lang/StringBuffer;)Ljava/lang/StringBuffer;" when calling method "<init>" with signature "()V" in class "com.shipley.ssl.CRD001J". I compiled the Java program on the System i using the JDK 1.4.2. I added a line in the program to run the command JAVA *VERSION to determine the JVM while the program is running -- it is using 1.4.2. Now for the strange part -- if I run the Java program from the command line using RUNJVA, the program runs with no problem. The only time I have a problem is when I run the program from an RPG program. I have stripped out everything in the RPG program to include only the bare minimums. My code is as follows: * Define object D crd001j S O Class(*JAVA: D 'com.shipley.ssl.CRD001J') * Define the Constructors D constr_crd001j PR O ExtProc(*JAVA: D 'com.shipley.ssl.CRD001J': D *CONSTRUCTOR) * D string PR O ExtProc(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D value 100A CONST VARYING * * string array for main class call..... * D args S O Class(*JAVA:'java.lang.String') D *CONSTRUCTOR) * D string PR O ExtProc(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D value 100A CONST VARYING * * string array for main class call..... * D args S O Class(*JAVA:'java.lang.String') D DIM(2) * * Define the main method - passing in one parameter D main PR ExtProc(*JAVA: D 'com.shipley.ssl.CRD001J': D 'main') D STATIC D O Class(*JAVA:'java.lang.String') D CONST D DIM(2) * * Define the main method - passing in one parameter D main PR ExtProc(*JAVA: D 'com.shipley.ssl.CRD001J': D 'main') D STATIC D O Class(*JAVA:'java.lang.String') D CONST D DIM(2) D OPTIONS(*VARSIZE) * D setdebug PR ExtProc(*JAVA: D 'com.shipley.ssl.CRD001J': D 'setDebug') D N Value * /Free // change the environment variables before the JVM is created commandstring = 'CHGCURDIR DIR(' + QUOTE + '/creditssl' + QUOTE + ')'; JCLCommand(commandstring); commandstring = 'ADDENVVAR ENVVAR(CLASSPATH) VALUE(' + QUOTE + '.:/creditssl/jt400Native.jar' + QUOTE + ') REPLACE(*YES)'; JCLCommand(commandstring); commandstring = 'JAVA *VERSION'; JCLCommand(commandstring); // constructor..... crd001j = constr_crd001j; // set the debug option setdebug(crd001j:*ON); // call the main class -- it will print out info in the log.... args(1) = string('Test 1'); args(2) = string('Test 2'); main(args); /End-free Any ideas???? ======================================= Mike Silvers, Chief Operating Officer Hainey Business Systems-Division of Affinigent, Inc IT Solutions for Business Performance Cell: (717) 324-5508 Phone: (717) 600-0033 ext 106 Fax: (877) 804-9589 http://www.affinigent.com <http://www.affinigent.com/> http://www.hbs-inc.com <http://www.hbs-inc.com/> AIM: IBMJavaMan Skype: hbs_mike_silvers =======================================
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.