Issue Details (XML | Word | Printable)

Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Kim Haase
Reporter: Kim Haase
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

Async example doesn't always fail as described

Created: 13/Jun/12 06:53 PM   Updated: 19/Jun/12 08:23 PM   Resolved: 19/Jun/12 08:23 PM
Component/s: doc
Affects Version/s: 6.0.7-3
Fix Version/s: 6.0.7-4

Time Tracking:
Not Specified

File Attachments: 1. Text File issue100.log (12 kB) 19/Jun/12 02:26 PM - Kim Haase

Participants: Ian Evans and Kim Haase

 Description  « Hide

At the end of the two sections on running the async example are the following sentences:

"If an error occurs, the status will read Encountered an error. Check the server.log file for your domain to find the cause of the error."

If a user happens to have run the mailconnector example before they run this example, and they still have the mock-javamail JAR file in their glassfish/lib directory, the status message they see will be "javax.ejb.EJBException", and the server log stack trace will contain

SEVERE: Error in sending message.
WARNING: EJB5184:A system exception occurred during an invocation on EJB MailerBean, method: public java.util.concurrent.Future async.ejb.MailerBean.sendMessage(java.lang.String)
WARNING: javax.ejb.EJBException
Caused by: java.lang.NullPointerException
at async.ejb.MailerBean.sendMessage(

I don't know if this belongs in the tutorial itself or in the FAQ – probably the latter?

Ian Evans added a comment - 19/Jun/12 12:01 AM

Could you attach your server.log? I want to know why the EJBException was thrown.

Does the mailconnector example also use mail/myExampleSession?

Kim Haase added a comment - 19/Jun/12 02:26 PM

Here is the server log from today, when I just started GF, edited the glassfish-resources file in async/setup, deployed async, and tried to send a message, then undeployed and shut down GF.

The javamail resource in mailconnector has a different name, mail/MySession.

I guess you are trying to figure out how to detect this particular problem and generate a useful error message? That would be good, though it is an error that won't occur if people run the tutorial examples in book order. At a minimum we should document the need to move the mock-javamail jar out of glassfish/lib if it happens to be there.

Ian Evans added a comment - 19/Jun/12 05:27 PM

I don't see a reason why the presence of mock-javamail.jar should cause an EJBException, I guess. I'd like to find out why. Documenting the workaround in the FAQ is probably the easy step, but if we can allow the different examples to co-exist that's preferable.

Ian Evans added a comment - 19/Jun/12 05:50 PM

Ok, so mock-javamail.jar doesn't implement an SMPTS provider.
SEVERE: Error in sending message.
SEVERE: No provider for smtps

The NPE was caused by how I was trying to log the exception. Just changing the catch to:
} catch (MessagingException ex) { logger.severe("Error in sending message."); status = "Encountered an error: " + ex.getMessage(); logger.severe(ex.getMessage()); }

Logs the error message properly and doesn't cause a system exception. I'll check in the changes, but we should add a FAQ entry documenting that you must remove mock-javamail.jar before running async.

Ian Evans added a comment - 19/Jun/12 06:36 PM

Fixed the NPE when the message couldn't be sent. The FAQ needs to be updated to include information on removing mock-javamail.jar from glassfish/lib.

Does the mailconnector example section need instructions on this as well?

Kim Haase added a comment - 19/Jun/12 06:51 PM

> Does the mailconnector example section need instructions on this as well?

Yes, we should add something at the end about removing it and restarting GlassFish just in case. Shall I do it as part of this issue?

Ian Evans added a comment - 19/Jun/12 06:56 PM

Sure. Go ahead and reopen it and reassign.

Kim Haase added a comment - 19/Jun/12 07:04 PM

I went ahead and made the documentation fix for the connector example as part of this issue.

Kim Haase added a comment - 19/Jun/12 08:09 PM

Assigning to myself for doc fix.

Kim Haase added a comment - 19/Jun/12 08:23 PM

Made fix in Epic and Frame versions of connector example chapter.