|
I have written RPG modul that is bridge between Java class that performs some parsing and other RPG programs who need some methods of parser. Here is code and problematic line is marked: H NOMAIN * * D string S O CLASS(*JAVA:'java.lang.String') D DIM(4) D javaString S O CLASS(*JAVA:'java.lang.String') D parser S O CLASS(*JAVA: D 'CustomerParserAPI.CustomerParser') D rpgString S 40A ************************************************************************** * subrocedures (interface prema Java klasama) D getChars PR 20A EXTPROC(*JAVA:'java.lang.String': D 'getBytes') VARYING D newString PR O EXTPROC(*JAVA:'java.lang.String': D *CONSTRUCTOR) D CLASS(*JAVA:'java.lang.String') D chars 40A CONST VARYING D newParser PR O EXTPROC(*JAVA: D 'CustomerParserAPI.CustomerParser': D *CONSTRUCTOR) D Adresa1 LIKE(string) D Adresa2 LIKE(string) D Adresa3 LIKE(string) D Adresa4 LIKE(string) D getCity PR O EXTPROC(*JAVA: D 'CustomerParserAPI.CustomerParser': D 'getCityName') D CLASS(*JAVA:'java.lang.String') D getPostal PR O EXTPROC(*JAVA: D 'CustomerParserAPI.CustomerParser': D 'getPostalaNo') D CLASS(*JAVA:'java.lang.String') D getStreetNm PR O EXTPROC(*JAVA: D 'CustomerParserAPI.CustomerParser': D 'getStreetName') D CLASS(*JAVA:'java.lang.String') D isDataReady PR N EXTPROC(*JAVA: D 'CustomerParserAPI.CustomerParser': D 'isDataAvaiable') ************************************************************************ *deklaracija subproceduraZaOstale RPG module D setupJavaModul PR N D ADR1 40A VALUE D ADR2 40A VALUE D ADR3 40A VALUE D ADR4 40A VALUE D getCityName PR 40A D getPostNumber PR 5A D getStreetName PR 40A ************************************************************************ *PUBLIC SUBPROCEDURES ************************************************************************ * SubProcedura: Setup Java Modul * * Returns : true if Parser can resolve data in fields and * data can be fetched with get Subs * false if Parser can't resolve problem * get Subs are unusefull * SubP is RPG interface for RPG programs. ************************************************************************ P setupJavaModul B EXPORT D setupJavaModul PI N D ADR1 40A VALUE D ADR2 40A VALUE D ADR3 40A VALUE D ADR4 40A VALUE /free string(1)= newString(ADR1); string(2)= newString(ADR2); string(3)= newString(ADR3); string(4)= newString(ADR4); parser=newParser(string(1):string(2):string(3):string(4)); return isDataReady(parser); //THIS LINE IS PROBLEMATIC /end-free P setupJavaModul E ************************************************************************ * SubProcedura: Get City Name * Returns : String represantion of city * * SubP is RPG interface for RPG programs. ************************************************************************ P getCityName B EXPORT D getCityName PI 40A /free javaString=getCity(parser); rpgString=getChars(javaString); return %Trim(rpgString); /end-free P getCityName E ************************************************************************ * SubProcedura: Get Postal Number * Returns : String represantion of Post Number * SubP is RPG interface for RPG programs. ************************************************************************ P getPostNumber B EXPORT D getPostNumber PI 5A /free javaString=getPostal(parser); rpgString=getChars(javaString); return %Trim(rpgString); /end-free P getPostNumber E ************************************************************************ * SubProcedura: Get Street Name * Returns : String represantion of Street name * SubP is RPG interface for RPG programs. ************************************************************************ P getStreetName B EXPORT D getStreetName PI 40A /free javaString=getStreetNm(parser); rpgString=getChars(javaString); return %Trim(rpgString); /end-free P getStreetName E In debugging mode when I try to execute marked line next exception occures. Message ID . . . . . . : RNX0301 Date sent . . . . . . : 12/11/04 Time sent . . . . . . : 17:35:51 Message . . . . : Java exception received when calling Java method. Cause . . . . . : RPG procedure SETUPJAVAM in program VBB2LIB/B2_KD_JVA received Java exception "java.lang.NoSuchMethodError: isDataAvaiable" when calling method "isDa" with signature "" in class "CustomerParserAPI.CustomerParser". Recovery . . . : Contact the person responsible for program maintenance to determine the cause of the problem. 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 I have another program that doesn't use isDataReady subp (isDataAvaiable) and it works perfectly. If I run java pgm that uses same Class and its methods it works without any exceptions.. I can't realize what's the problem with this method?? Please HELP, I have lost my mind with this. Thanks! PS. What's the best literature to read and it s abouth integrating RPG and Java. Most of the things I found in WebSphere ILE RPG ProgrammersGuide but there is still a lot of questions without answers. Igor Bešlić, dipl. ing. rač. tel: +385 1 6326422 e-mail: Igor.Beslic@xxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
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.