Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RPG/Java problem

Status
Not open for further replies.

iSeriesCodePoet

Programmer
Jan 11, 2001
1,373
US
Hey guys, sorry about the length.

I am working on linking RPG and java programs together. I have written a couple modules, one for each class I am interfacing. They both seem to work just fine except for one method. I keep getting:

Code:
Message ID . . . . . . :   RNX0301       Severity . . . . . . . :   50        
Message type . . . . . :   Escape                                             
Date sent  . . . . . . :   12/12/03      Time sent  . . . . . . :   14:40:56  
                                                                              
Message . . . . :   Java exception received when calling Java method.         
Cause . . . . . :   RPG procedure DOCP_UPLOA in program PDFPGMSNEW/F.DOCPROC  
  received Java exception "java.lang.NoSuchMethodError: UploadFile" when      
  calling method "UploadFile" with signature                                  
  "(Lcom.taylor.docgate.Docfile;Ljava.lang.String;Ljava.lang.String;)Ljava.lan
  g.Boolean;" in class "com.taylor.docgate.Docprocess".                       
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
  type and parameter types match. You can determine the signatures for all the
  methods in class XYZ using command QSH CMD('javap -s XYZ').

Now I can call other methods in the class just fine, and I have recompiled several times. Below is the code I am using. I have talked to our java programmers and some others who I know deal a bit with java and no one can seem to find my signature error. DocP, String, and DocFile are defined as constants for the appropriate class, so 'String' is 'Const('java.lang.String')'.

This is my subprocedure:
Code:
     P*--------------------------------------------------
     P* Procedure name: DocP_UploadFile
     P* Purpose:        Upload a file to DocuShare
     P* Returns:
     P* Parameter:      Document => Core DocuShare document information
     P* Parameter:      AuthToken => Autority Token
     P* Parameter:      URL
     P*--------------------------------------------------
     PDocP_UploadFile  B                   EXPORT
     DDocP_UploadFile  PI
     D  objDocP                        O   Class(*Java: DocP)
     D  Document                       O   CLASS(*JAVA:DocFile)
     D                                     CONST
     D  AuthToken                      O   CLASS(*JAVA:String)
     D                                     CONST
     D  URL                         500A   CONST
     D                                     OPTIONS(*VARSIZE)

     D uploadDoc       PR              O   ExtProc(*Java: DocP: 'UploadFile')
     D                                     Class(*Java: 'java.lang.Boolean')
     D  Doc                            O   Class(*Java: DocFile) Const
     D  AuthToken                      O   Class(*Java: String) Const
     D  URL                            O   Class(*Java: String) Const

     D boolean         S               O   Class(*Java: 'java.lang.Boolean')

      /FREE

       monitor;
         boolean = uploadDoc(objDocP: Document: AuthToken: #cvtToString(URL));
         return;
       on-error *all;
         return;
       endmon;

      /END-FREE
     PDocP_UploadFile  E


And this is my java method:
Code:
Public boolean UploadFile(Docfile objDocFIle, String authToken, String url) throws DocgateException{  
   return objDocgateDAO.UploadFile(objDocFIle,authToken,url);        
}
If you see anything wrong or have any other ideas. Please let me know. I am starting to loose hair over this.

iSeriesCodePoet
iSeries Programmer/Lawson Software Administrator
[pc2]
See my progress to converting to linux.
 
Okay, I finally got an answer. Apparently, 'java.lang.Boolean' isn't the same as 'boolean'. By changing the 'O' to an 'N' on the return parm for the java definition it then becomes a boolean.

Code:
     D uploadDoc       PR              N   ExtProc(*Java: DocP: 'UploadFile')
     D  Doc                            O   Class(*Java: DocFile) Const
     D  AuthToken                      O   Class(*Java: String) Const
     D  URL                            O   Class(*Java: String) Const

Is what it should look like.

If you started to work on this. Thanks for trying!

iSeriesCodePoet
iSeries Programmer/Lawson Software Administrator
[pc2]
See my progress to converting to linux.
 
Can you tell me exactly how you fixed this issue? Was the problem with the EXTPROC keyword definition? I have the same error and when I look at your fixed code it looks just like mine. Can I send you a snippet to look at?

Thank you in advance.
Dianne Purl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top