I'm not getting a stack trace, since the method is never getting invoked.
Here's the error I'm receiving:
Message ID . . . . . . : RNX0301
Date sent . . . . . . : 03/08/11 Time sent . . . . . . : 14:19:22
Message . . . . : Java exception received when calling Java method.
Cause . . . . . : RPG procedure GWBA09D5 in program MXMLIB/GWBA09D5 received
Java exception "java.lang.NoSuchMethodError: resendOrder" when calling
method "resendOrder" with signature
"(Ljava.lang.String;Ljava.lang.String;)Ljava.lang.String;" in class
"com.WMS_BPCS_Integrator.executable.ResendOrder".
Which, based on all the documentation I've been reading, means the signatures don't match. But here's the result from the javap command:
Compiled from "ResendOrder.java"
public class com.WMS_BPCS_Integrator.executable.ResendOrder extends
java.lang.Object{
public com.WMS_BPCS_Integrator.executable.ResendOrder();
Signature: ()V
public static java.lang.String resendOrder(java.lang.String, java.lang.String
);
Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
}
Press ENTER to end terminal session.
As far as I can tell, the signatures match. I haven't misspelled the method name. And the class is being found (I tested that by changing the class name in the procedure and got a class not found error). Maybe there's something odd about the configuration on this iSeries or something. I don't know. But regardless of how I configure this, I get the same error over and over and over again.
-----Original Message-----
From: Gary L Peskin <garyp@xxxxxxxxxxxx>
To: 'Java Programming on and around the IBM i' <java400-l@xxxxxxxxxxxx>
Sent: Tue, Mar 8, 2011 2:42 pm
Subject: RE: Signature mismatch when calling java prototype
Can you post the stack trace that you're receiving?
Gary
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On Behalf Of mikemonger@xxxxxxx
Sent: Tuesday, March 08, 2011 11:24 AM
To: java400-l@xxxxxxxxxxxx
Subject: Re: Signature mismatch when calling java prototype
Still no dice.
The modified prototype:
d ResendOrder pr o static extproc(*JAVA:
d
'com.DelMonte.WMS_BPCS_Integrator.ex-
d
ecutable.ResendOrder':'resendOrder')
d class(*JAVA:'java.lang.String')
d o class(*JAVA:'java.lang.String')
d const
d o class(*JAVA:'java.lang.String')
d const
The modified procedure call:
ReturnMsg=ResendOrder(string(wmfac):string(charOrd));
The modified method declaration:
public class ResendOrder
{
public static String resendOrder(String Facility, String Order)
{..)
}
I think...at this point...I'm just going to have the result returned via
a data structure. Based on all the documentaion I've looked at, there's
absolutely no reason this shouldn't work. The issue can't be that the
signatures don't match, because they do. So the issue is something else
completely inexplicable.
It's the cludgy way to do it, but it'll work.
-----Original Message-----
From: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
To: Java Programming on and around the IBM i <java400-l@xxxxxxxxxxxx>
Sent: Tue, Mar 8, 2011 1:47 pm
Subject: RE: Signature mismatch when calling java prototype
ike Barbara said, STATIC.
There's nothing wrong with using STATIC procedures (now that I know the
syntax
-) ). You don't have to go through the pain of running the CONSTRUCTOR
first.
f you don't need instance objects, don't use them. Referencing a static
method utomatically creates the class object the first time you use it,
but no nstance objects. The class object contains only the static
members and methods.
ut don't call it "main". A class does not have to have a "main" unless
you want he RUNJVA command to start there. Java function main is really
meant for just hat; the place to start when the JVM starts up. You can
specify any other unction as static. In fact, you can have a static
method and non-static method ith the same name; they'll have different
signatures.
So here's what I'd suggest for your prototype:
ResendOrder pr o STATIC extproc(*JAVA:
'com.WMS_BPCS_Integrator.ex-
ecutable.ResendOrder':'resendOrder')
class(*JAVA:'java.lang.String')
o class(*JAVA:'java.lang.String')
dim(2)
And your method definition should look like this:
String static resendOrder(String[] input{ return "gotcha";
I just noticed you're passing in a String array (dim(2)) and not two
String's.
f course that's the classic signature for the JVM startup method: static
void ain(String[] xx) -----Original Message-----
rom: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On ehalf Of mikemonger@xxxxxxx
ent: Tuesday, March 08, 2011 12:12 PM
o: java400-l@xxxxxxxxxxxx
ubject: Re: Signature mismatch when calling java prototype
nd that's what I don't understand. You're doing essentially what I'm
doing, ut with 90 character parms instead of string objects.
Why does your work but mine doesn't? It makes no sense.
-----Original Message-----
rom: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
o: Java Programming on and around the IBM i <java400-l@xxxxxxxxxxxx>
ent: Tue, Mar 8, 2011 12:10 pm
ubject: RE: Signature mismatch when calling java prototype
'm goofing up terminology here: where I said member object, I should
have said
stance object.
----Original Message-----
om: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On
half Of Dan Kimmel
nt: Tuesday, March 08, 2011 10:49 AM
: Java Programming on and around the IBM i
bject: RE: Signature mismatch when calling java prototype Here's a
working
rototype.
* Create the workpiece
dcreateWorkpiece...
d pr 90a extproc(*java :
d 'com.rjssoft.workflow.util.+
d WorkpieceCreationInfo' :
d 'createWorkpiece')
d varying
d user 90a const varying
d password 90a const varying
t takes two byte array parameters and returns a byte array, all 90
characters
ng.
hen this function is executed from RPG, the member object
(newWorkpieceCreationInfo)
s already been created and is the first parameter passed. The return
value is
wWorkpieceID.
newWorkpieceID =
createWorkpiece...
(newWorkpieceCreationInfo :
%trim(checkinUser) :
%trim(checkinPassword) );
-----Original Message-----
om: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On
half Of mikemonger@xxxxxxx
nt: Tuesday, March 08, 2011 10:18 AM
: java400-l@xxxxxxxxxxxx
bject: Re: Signature mismatch when calling java prototype
ee, here's the funny part about that static keyword.
f I don't include it, the program won't compile unless I include the
return
riable as the first parameter in the prototype call.
ut when I do that....I get the exact same error. And what's funny is
that it
ports the same signature being sent (String,String)String. Which
doesn't make
hole lot of sense to me, but, whatever.
've never had problems calling java classes with prototypes in the past.
But
is is the first time that I've actually tried to get something back from
one.
nd the issue doesn't seem to be whether to method is static or not in
the lass.
'm getting the same thing no matter how I define it.
----Original Message-----
om: Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>
: Java Programming on and around the IBM i <java400-l@xxxxxxxxxxxx>
nt: Tue, Mar 8, 2011 11:07 am
bject: RE: Signature mismatch when calling java prototype
otice that little word "static" in the definition of your "main"
function?
is prototype is trying to invoke the method "main" on a member object.
The
ction only exists in the class object. Thus, the error, no such method
xists.
think there's a way to invoke a static method from RPG, but I've never
tried d
on't know the syntax.
other tip: Unless you want to go through another set of Java calls,
declare ur
unction to take and return byte arrays. Byte arrays work just fine in
both G
nd Java so you don't have to go through another set of calls to get the
RPG
iable from the String.
your java should look something like this:
yte[] myFunction( byte[] input){
eturn "Something".getBytes();
----Original Message-----
m: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-
bounces@xxxxxxxxxxxx] On
alf Of mikemonger@xxxxxxx
t: Tuesday, March 08, 2011 9:11 AM
java400-l@xxxxxxxxxxxx
ject: Signature mismatch when calling java prototype Ok, I'm officially
at my
its end. I've written a java class which accepts an ray of string
objects and
eturns a string. Here is the prototype in the RPG
gram:
ResendOrder pr o extproc(*JAVA:
'com.WMS_BPCS_Integrator.ex-
ecutable.ResendOrder':'main')
class(*JAVA:'java.lang.String')
o class(*JAVA:'java.lang.String')
dim(2)
wever, when I call it, I'm receiving the following error:
use . . . . . : RPG procedure GWBA09D5 in program MXMLIB/GWBA09D5
received
ava exception "java.lang.NoSuchMethodError: main" when calling method
main" with signature "([Ljava.lang.String;)Ljava.lang.String;" in class
com.WMS_BPCS_Integrator.executable.ResendOrder".
W HERE'S THE FUNNY PART.
en I pull up the class with javap -s, here's what I get for the
signatures:
blic class com.WMS_BPCS_Integrator.executable.ResendOrder extends
a.lang.Object{
lic com.DelMonte.WMS_BPCS_Integrator.executable.ResendOrder();
ignature: ()V
lic static java.lang.String main(java.lang.String[]);
ignature: ([Ljava/lang/String;)Ljava/lang/String;
otice how the signatures match? So do I.
is class works just fine as long as I don't try to RETRIEVE a parm.
Removing e
eturn value from both the prototype and the class has the class running
rmally.
o...is it possible to actually prototype a java class so that it
actually does
urn a value to the calling RPG program, or am I banging my head against
the ll
or nothing?
ve tried everything that I can think of so far. I even tried changing
it to a
nstructor procedure and passing in the parms that way, but it really
didn't ke
hat.
s is the Java Programming on and around the IBM i (JAVA400-L) mailing
list To
t a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
hange
st options,
it:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to
iew the archives at
http://archive.midrange.com/java400-l.
-
s is the Java Programming on and around the IBM i (JAVA400-L) mailing
list o
st a message email: JAVA400-L@xxxxxxxxxxxx o subscribe, unsubscribe, or
change
st options,
it:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx
ore posting, please take a moment to review the archives t
ttp://archive.midrange.com/java400-l.
-
is is the Java Programming on and around the IBM i (JAVA400-L) mailing
list To
st a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
hange
ist options,
sit:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to
view the archives at
http://archive.midrange.com/java400-l.
--
is is the Java Programming on and around the IBM i (JAVA400-L) mailing
list o
ost a message email: JAVA400-L@xxxxxxxxxxxx o subscribe, unsubscribe, or
change
ist options,
sit:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx
fore posting, please take a moment to review the archives t
ttp://archive.midrange.com/java400-l.
--
is is the Java Programming on and around the IBM i (JAVA400-L) mailing
list o
ost a message email: JAVA400-L@xxxxxxxxxxxx o subscribe, unsubscribe, or
change
ist options,
sit:
http://lists.midrange.com/mailman/listinfo/java400-l
email: JAVA400-L-request@xxxxxxxxxxxx
fore posting, please take a moment to review the archives t
ttp://archive.midrange.com/java400-l.
-
his is the Java Programming on and around the IBM i (JAVA400-L) mailing
list
o post a message email: JAVA400-L@xxxxxxxxxxxx
o subscribe, unsubscribe, or change list options,
isit:
http://lists.midrange.com/mailman/listinfo/java400-l
r email: JAVA400-L-request@xxxxxxxxxxxx
efore posting, please take a moment to review the archives
t
http://archive.midrange.com/java400-l.
--
his is the Java Programming on and around the IBM i (JAVA400-L) mailing
list
o post a message email: JAVA400-L@xxxxxxxxxxxx
o subscribe, unsubscribe, or change list options,
isit:
http://lists.midrange.com/mailman/listinfo/java400-l
r email: JAVA400-L-request@xxxxxxxxxxxx
efore posting, please take a moment to review the archives
t
http://archive.midrange.com/java400-l.
--
This is the Java Programming on and around the IBM i (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.
-
his is the Java Programming on and around the IBM i (JAVA400-L) mailing list
o post a message email: JAVA400-L@xxxxxxxxxxxx
o subscribe, unsubscribe, or change list options,
isit:
http://lists.midrange.com/mailman/listinfo/java400-l
r email: JAVA400-L-request@xxxxxxxxxxxx
efore posting, please take a moment to review the archives
t
http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.