|
My guess: "getMessageBc" with signature "()¢B" is trying to tell you there
is no such method that returns an array of bytes. This would normally be
described as "[B" but apparently shows up as "¢B" in your encoding. A
static method that returns a String should be prototyped like this:
D getMsgBcObj PR O
D EXTPROC(*JAVA
D :'mypath.SendSmtpMail'
D :'getMessageBc')
D CLASS(*JAVA:'java.lang.String')
D STATIC
That's according to the V5R1 ILE RPG programmer's guide (page 160).
PC2
-----Original Message-----
From: Patrick Goovaerts [mailto:pgoovaerts@pandora.be]
Sent: February 24, 2002 12:59
To: java400-l@midrange.com
Cc: rpg400-l@midrange.com
Subject: Calling JAVA-accessors from RPG
Hey guy's,
Now that I can use a java class in RPG I want to set/retrieve fields
using the getters/setters accessors. This is what I want :
1) Initialize the class
2) do some 'first things' (static method)
3) set some fieldvalues (static setter-method)
4) work with the values (static method's)
5) retrieve fieldvalues (static getter-method)
This is the result
1) I don't have to do this because I only use Static method's
2) this works
3) seems to be working (do not receive any error)
4) seems to be working, no error, but it seems that fields are still
empty?
The writeSmtpLine(String, String) works, data from parameters are
printed but the field with previously filled data (3) isn't.
5) program error
When I try to get the data from the field back in my RPG prog to check
the data, the program halts with an error that the method doesn't exist.
The method is a static method which has no inputparm and should return a
String.
The statement in error = eval FieldValue=getMsgBcObj()
Can someone tell me where my coding goes wrong pleaaaase?
Patrick Goovaerts
IT/Clipper Support nv
************************************************************************
*****
RPGERROR:
Additional Message Information
Message ID . . . . . . : RNQ0301
Date sent . . . . . . : 24/02/02 Time sent . . . . . . :
21:37:01
Message . . . . : Java exception received when calling Java method (C
G D
F).
Cause . . . . . : RPG procedure SNDSMTP in program SNDSMTP/LSSYST
received
Java exception "java.lang.NoSuchMethodError: getMessageBc" when
calling
method "getMessageBc" with signature "()¢B" in class
"mypath.SendSmtpMail".
Recovery . . . : Contact the person responsible for program
maintenance to
determine the cause of the problem.
Possible choices for replying to message . . . . . . . . . . . . . . .
:
D -- Obtain RPG formatted dump.
S -- Obtain system dump.
G -- Continue processing at *GETIN.
More...
Press Enter to continue.
F1=Help F3=Exit F6=Print F9=Display message details
F10=Display messages in job log F12=Cancel F21=Select assistance
level
************************************************************************
*******
************************************************************************
*******
RPG Coding
...
D FieldValue S 128 inz(*blank)
Field Value To Test
...
D setMsgBcP1 S O
CLASS(*JAVA:'java.lang.String') Send msg Bc
...
'* Prototype Procedure for accessors of field messageBc in
'SendSmtpMail' object
'* Setter
'* Parm1 = Emailaddress
Blind-Copy-receiver(s)
D setMsgBcObj PR EXTPROC(*JAVA
D :'mypath.SendSmtpMail'
D :'setMessageBc')
D STATIC
D charPmsgBc1 LIKE(string)
'* Getter
D getMsgBcObj PR 128A
D EXTPROC(*JAVA
D :'mypath.SendSmtpMail'
D :'getMessageBc')
D STATIC
...
C eval setMsgBcP1 = newString('DATATEXT')
C callp setMsgBcObj(setMsgBcP1)
* Move Write Subject to message
C eval writeP1 = newString('Subject:')
C eval writeP2 = newString('Data for
subject')
C callp writeSmtpObj(writeP1:writeP2)
...
C Eval FieldValue = getMsgBcObj()
...
************************************************************************
*****
************************************************************************
*****
JAVA Coding
...
public static void setMessageBc(java.lang.String newMessageBc) {
messageBc = newMessageBc;
}
...
public static java.lang.String getMessageBc() {
return messageBc;
}
...
public static void writeSmtpLine(String smtpTextType, String smtpText)
{
if (smtpTextType.equals("To:"))
{
smtpMessageToOK = true;
msg.println(smtpTextType + " " + smtpText);
}
else
{
if (smtpTextType.equals("Subject:"))
{
smtpMessageSubjectOK = true;
msg.println(getMessageBc() + smtpText);
}
else
{
msg.println(smtpText);
}
}
}
************************************************************************
*****
_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.