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



Josh,

Thanks for the input.  It does not look like a classpath issue.  There
is only one version of the class on the IFS -- I rechecked to make
sure...

Mike 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Josh Diggs
Sent: Wednesday, February 07, 2007 10:01 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Problems with RPG Java call

This sounds like a classpath issue to me.  Maybe the classpath is the
same when you compile and when you run the java program from the command
line, but different within your RPG program.  If you have a different
version of the class you are calling in the classpath of the JVM for the
RPG program that does not include the method in question you might
experience the symptoms you are describing.  Just a shot in the dark.

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Mike Silvers
Sent: Wednesday, February 07, 2007 6:21 AM
To: RPG programming on the AS400 / iSeries
Subject: Problems with RPG Java call


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
=======================================
 
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



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.