× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You need to specify what the constructor will be returning. In this case
an instance of MessageOut. Try this:

D* Prototypes                                                         
D create          PR              O   EXTPROC(*JAVA:                  
D                                     'com.rbsg.rbsis.imarket.message-
D                                     .MessageOut':                   
D                                     *CONSTRUCTOR)                   
D                                                 CLASS(*JAVA:
D                                     'com.rbsg.rbsis.imarket.message.+
D                                      MessageOut')
D   compID                      10I 0 VALUE                           
D   deptID                      10I 0 VALUE                           
D   source                       3A   CONST VARYING     
D   groupCode                    3A   CONST VARYING     
D   jobCode                      5A   CONST VARYING     
D   pkgLib                      10A   CONST VARYING

Dan Feather

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of McCully, Keith (RBS
Insurance)
Sent: Thursday, August 03, 2006 10:36 AM
To: 'Java Programming on and around the iSeries / AS400'
Subject: Error calling constructor from RPG

 
I'm trying to instantiate a class from an RPG program. The class runs
fine
when executed from Qshell.

However, when I call the class from RPG I get the Java exception
"java.lang.NoSuchMethodError: <init>" when calling method "<ini" with
signature "" in class com.rbsg.rbsis.imarket.message.MessageOut".  

I've checked my classpath and confirm that the directory structure for
the
package "com.rbsg.rbsis.imarket.message" is
/Nigc/imarket/com/rbsg/rbsis/imarket/message and /Nigc/imarket is in my
classpath.   

I've kept my test Java class and RPG source simple as I'm new to mixing
the
two and don't want to obscure the problem.             

I'm thinking that it might be an environment set up problem but accept
that
it could be a RPG runtime error.

Here's the Java source which is just a constructor for now:

=============================================================== 

package com.rbsg.rbsis.imarket.message;

public class MessageOut {

        //Instance variables

        public MessageOut(int comp, int dept, String source,
                String groupCode,
                String jobCode,
                String pkgLib) {


                System.out.print("Company= " + comp);


        }

}
=============================================================== 
And here's the RPG:
=============================================================== 

H THREAD(*SERIALIZE) dftactgrp(*no) actgrp('test')                    
 *--------------------------------------------------------------------
 *                                                                    
D compID          S             10I 0 INZ(001)                        
D deptID          S             10I 0 INZ(100)                        
D source          S              3A   INZ('KWM')                      
D groupCode       S              3A   INZ('KWM')                      
D jobCode         S              5A   INZ('00003')                    
D pkgLib          S             10A   INZ('IS2BACGEN')                
D MessageOut      S               O   CLASS(*JAVA:                    
D                                     'com.rbsg.rbsis.imarket.message-
D                                     .MessageOut')                   
D*                                                                    
D* Prototypes                                                         
D create          PR              O   EXTPROC(*JAVA:                  
D                                     'com.rbsg.rbsis.imarket.message-
D                                     .MessageOut':                   
D                                     *CONSTRUCTOR)                   
D   compID                      10I 0 VALUE                           
D   deptID                      10I 0 VALUE                           
D   source                       3A   CONST VARYING     
D   groupCode                    3A   CONST VARYING     
D   jobCode                      5A   CONST VARYING     
D   pkgLib                      10A   CONST VARYING     
D*                                                      
D*                                                      
 /free                                                  
                                                        
       MessageOut = create(compID: deptID: source       
                          :groupCode: jobCode : pkgLib);
                                                        
                                                        
     Return;                                            
 /end-free      
=============================================================== 

Thanks,

Keith

                                        


The Royal Bank of Scotland plc, Registered in Scotland No. 90312.
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only.
If the message is received by anyone other than the addressee, please
return the message to the sender by replying to it and then delete the
message from your computer. Internet e-mails are not necessarily secure.
The Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the
onward transmission, opening or use of this message and any attachments
will not adversely affect its systems or data. No responsibility is
accepted by The Royal Bank of Scotland plc in this regard and the
recipient should carry out such virus and other checks as it considers
appropriate.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.