Dan,

I've amended the RPG code as below but still get the same Java exception

Thanks,

Keith


*************** Beginning of data *************************************
H THREAD(*SERIALIZE) dftactgrp(*no) actgrp('fred')                     
 *---------------------------------------------------------------------
 *                                                                     
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                                     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     
D*                                                      
D*                                                      
 /free                                                  
                                                        
       MessageOut = create(compID: deptID: source       
                          :groupCode: jobCode : pkgLib);
                                                        
                                                        
     Return;                                            
 /end-free                                               

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]

Sent: 03 August 2006 16:54
To: Java Programming on and around the iSeries / AS400
Subject: RE: Error calling constructor from RPG

*** WARNING : This message originates from the Internet ***

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.

--
This is the Java Programming on and around the iSeries / AS400
(JAVA400-L) mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.
NOTICE: This electronic mail message and any files transmitted with it are
intended exclusively for the individual or entity to which it is addressed.
The message, together with any attachment, may contain confidential and/or
privileged information. Any unauthorized review, use, printing, saving,
copying, disclosure or distribution is strictly prohibited. If you have
received this message in error, please immediately advise the sender by
reply email and delete all copies.

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.



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 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.