Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

Debugging AIR Code.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Guest's Avatar
    Guest replied
    In AirEmail_newMessage there is a boolean variable svDebug which I have set in the original code. This is used by Session_setDebug(svSession:svDebug); to display debug information when the email is sent.

    You are correct; The gobbledy-gook is the attachment. You could test this out by running air14_01 or air14_02 and notice that there is no gobbledy-gook. So, this shows you that the attachment is being sent.

    For a test, maybe you could download the attachment you are attempting to send from the IBM i and send it from your PC using the same account that you are using on the i and using the same email relay; with a windows/linux/mac client.

    I don't know if you have another email relay available to try it on. For testing, I used my internal relay and I also used my personal email relay to check out different behaviors.

    I hope this helps and good luck with your project. Sounds like you're almost there!
    Tom

    Leave a comment:


  • eftimios
    replied
    Thanks for monitoring the forum and helping Tom.

    I'm trying to fit in the examples and book in amongst my other work and want to get to the stage where I can create excel and email it.
    I'll then use the book and working examples to create my own solution for our own data.

    I tried Barbara Morris's suggestion of running the AIR14_03 program in QSH with:

    QSH CMD('/qsys.lib/airlib.lib/air14_03.pgm')

    When I ran this the debug echoes generated quite a few statements.

    I'm now at thepoint where I'm getting the email, but not the attachments.

    When I look at the debug log I can see where it seems to have the binary attachments (which appear as large swathes of gobbledy-gook)

    I won't include the output in this email due to size.

    Would there be anything in the log that would let me know if the attachments were sent?

    I asked our SMTP person if there might be anything on the server that would reject atatchments and he says not.

    Thanks again.

    Leave a comment:


  • Guest's Avatar
    Guest replied
    There is a lot of information to be found in the Exception class. For simplicity of the book I just displayed it on the screen, in order to do that I only used a 52 character variable to hold the value to be displayed on the screen. You could define a larger variable and look at it in debug to get more information.

    You could also use the getMessage method of the Exception class for more information which was also included in SPAIRJAVA


    D Exception_getMessage...
    D PR ExtProc(*JAVA
    D :'java.lang.Throwable'
    D :'getMessage')
    D like(jstring)


    Here is what your error display procedure could look like:


    P************************************************* *****************
    P* Air_isJVMError(): Indicates Throwable Exception Found
    P************************************************* *****************
    P Air_isJVMError B EXPORT
    D Air_isJVMError PI 1N
    D svReturn S 1N
    D svThrowable S like(jthrowable)
    D svString S like(jstring)
    D svBigMessage S 1024A
    D svMessage S 52A
    /free
    svReturn = *OFF;
    if (JNIEnv_P = *NULL);
    JNIEnv_P = getJNIEnv();
    else;
    endif;
    svThrowable = ExceptionOccurred(JNIEnv_P);
    if (svThrowable = *NULL);
    else;
    svReturn = *ON;
    svString = Exception_toString(svThrowable);
    svBigMessage = String_getBytes(svString);
    // Place breakpoint here to EVAL svBigMessage.
    svMessage = %trim(svBigMessage);
    dsply svMessage;
    svString = Exception_getMessage(svThrowable);
    svBigMessage = String_getBytes(svString);
    svMessage = %trim(svBigMessage);
    dsply svMessage;
    ExceptionClear(JNIEnv_P);
    endif;
    freeLocalRef(svThrowable);
    freeLocalRef(svString);
    return svReturn;
    /end-free
    P E


    You could place a breakpoint right after svBigMessage is assigned to see more information.

    By looking at the exception that you are receiving, I would probably say that the file you are trying to attach does not exist or is not closed. I would recheck that to make sure that is not the error.

    Here is an article on IBM that may be helpful about System.out:
    http://www-01.ibm.com/support/docvie...256e98006fbb5f

    Leave a comment:


  • eftimios
    started a topic Debugging AIR Code.

    Debugging AIR Code.

    I've got to example AIR14_03 in the book and am failing in:

    65 AirEmail_send(airMessage:recipients);

    I debugged into the service program and the SVAIREMAIL traps the error at:

    400 CallTransportSendMethod(JNIEnv_P:sendClass:
    401 sendID:argMsg:recipients);
    402 if (Air_isJVMError());
    403 displayString = 'TransportSend Error';
    404 DSPLY displayString;

    The job displays(I put the classes into /AIR/JAVA):

    > call air14_03

    Environment variable added.
    DSPLY Java Version: 1.4.2
    DSPLY Java ClassPath: .:/AIR/JAVA/Excel_POI/poi-3.0.2-FINA
    DSPLY javax.mail.MessagingException: IOException while sen
    DSPLY TransportSend Error

    I'm guessing that some property has not been set correctly earlier in the code.
    Earlier examples have compiled and run correctly, so I'm guessing that the error is something specific to this example.

    I have no idea where I've gone wrong and am now interested in knowing how to find clues and resolve these problems by myself. The book is a little thin on how to self-manage this stuff and I'm a bit overwhelmed with detail at the moment.

    I understand there are 3 files generated by the JVM: stdin, stdout and stderr.

    Where do these files end up? Are they in the ifs? I've looked, but haven't stumbled across them.
    And if I do find them, will stderr help?

    The SVAIREMAIL service program also sets the debug property: Session_setDebug(svSession:svDebug);
    But what is produced and where? I presume this setting enables the JAVAMAIL software to log information as it runs.

    Thanks In Advance.
Working...
X