Well I thought I had it working, but now I am stuck again. I am getting the following error:
Cause . . . . . : RPG procedure CG0001 in program GDSBILLBLD/CG0001 received
Java exception "java.lang.NoSuchMethodError: createAccount" when calling
method "createAccount" with signature
"(Ljava.lang.String;Ljava.util.Hashtable;Ljava.lang.String;Ljava.lang.Boolea
n;)V" in class "com.stalker.CGPro.CGProCLI".
Here is my call in RPG
createAccount(Conn:saccountName
:settings
:smailboxName
:FALSE);
And here is the java method and my prototype.
* void createAccount(String accountName, Hashtable settings, String
* accountType,boolean external)
D
D createAccount...
D PR ExtProc(*JAVA:CGConnectClass:
D 'createAccount')
* method parameters
D accountName O Class(*JAVA:'java.lang.String')
D Const
D settings O Class(*JAVA:'java.util.Hashtable'
D Const
D accountType O Class(*JAVA:'java.lang.String')
D Const
D external O Class(*JAVA:'java.lang.Boolean')
D Const
Any help would be greatly appreciated.
Jon> From: rvrratjon@xxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> Subject: RE: Calling Java from RPG> Date: Mon, 11 Feb 2008 19:01:22 +0000> > > That works. Thanks again Scott.> > > > Date: Mon, 11 Feb 2008 12:21:30 -0600> > From: rpg400-l@xxxxxxxxxxxxxxxx> > To: rpg400-l@xxxxxxxxxxxx> > Subject: Re: Calling Java from RPG> >> > Hi Jon.> >> >> One of the methods that I am calling has a parameter of a data type> >> hashtable. How on earth do I create that in RPG? Data Structure?> >> Array?> >> > The Hashtable parameter from your code snippet appears to be a Java> > object. From RPG, that'd be data type O, with the CLASS keyword to> > describe which Java class it refers to. You've already done this with> > the String data type in some of the previous code examples in this> > thread -- the only difference is that you'll want to use> > java.util.Hashtable in the CLASS keyword instead of the java.lang.String> > that you posted before.> >> > Personally, I prefer to create a standalone variable like this:> >> > D Hashtable s O CLASS(*JAVA> > D :'java.util.Hashtable')> >> > Then, in your prototype for the Java method, you can declare the> > parameter as "like(Hashtable)". That way, you don't have to retype the> > whole CLASS thinggy on your prototype.> >> > You'll need to have a separate prototype for the Hashtable constructor,> > and another prototype for the "put" method in order to duplicate the> > code from the example you posted. The following code is untested, it's> > just off the top of my head, hopefully it'll give you an idea of what to do:> >> >> > D new_Hashtable pr like(Hashtable)> > D extproc(*JAVA> > D :'java.util.Hashtable'> > D :*CONSTRUCTOR)> >> > D Hashtable_put pr like(jObject)> > D extproc(*JAVA> > D :'java.util.Hashtable'> > D :'put')> > D key like(jObject) const> > D value like(jObject) const> >> > D settings s like(Hashtable)> >> > /free> >> > settings = new_Hashtable();> > Hashtable_put( settings> > : new_String('RealName')> > : new_String('Jojn X. Smith') );> > Hashtable_put( settings> > : new_String('MaxAccountSize')> > : new_String('100K') );> >> > .> > .> > .> >> > CLI_createAccount( new_String('john@xxxxxxxxxxx')> > : settings> > : *NULL> > : FALSE );> >> > Hope that makes sense.> > --> > 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.> >> > _________________________________________________________________> Helping your favorite cause is as easy as instant messaging. You IM, we give.>
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join> -- > 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.>
_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx
As an Amazon Associate we earn from qualifying purchases.