roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave <>
Subject Re: Problems with email notification under GlassFish
Date Fri, 21 Mar 2008 16:20:45 GMT
On Fri, Mar 21, 2008 at 11:28 AM, Stephan M├╝hlstrasser
<> wrote:
> Hi,
>  as I'm new to this list, please apologize if this problem came up
>  before, but I didn't find an easy way to check this against the archive
>  of this list under
>  as there seems to be no search capability.
>  I had a hard time to set up email notification for Roller 4.0 with
>  GlassFish 9.1_01. I use the SMTP server by my hosting company, which
>  requires SMTP authentication.
>  My first attempt was to configure email via JNDI, with this snipper from
>  the file:
>  mail.configurationType=jndi
>  This turned out to be impossible, as Roller assumes that the applicaton
>  server sets up the javax.mail.Session object in a way that Roller itself
>  does not have to care about SMTP authentication. As far as I could find
>  out, it is not possible to set up the JavaMail resource in GlassFish
>  with the SMTP username and password so it does fulfill that assumption.
>  Then I switched to the properties-style mail configuration:
>  mail.configurationType=properties
>  mail.hostname=<my server>
>  mail.username=<my SMTP username>
>  mail.password=<my SMTP password>
>  In that case I always got a javax.mail.AuthenticationFailedException. I
>  spotted a potential problem in the Roller source code, but I'm not sure
>  whether this problem only occurs in connection with GlassFish. Consider
>  the following source code from
>  org/apache/roller/weblogger/util/
>  > Transport transport = mailProvider.getTransport();
>  >
>  >         // Try to send while there remain some potentially good addresses
>  >         try {
>  >             do {
>  >                 // Avoid a loop if we are stuck
>  >                 nAddresses = remainingAddresses.length;
>  >
>  >                 try {
>  >                     // Send to the list of remaining addresses, ignoring the addresses
attached to the message
>  >                     transport.send(message, remainingAddresses);
>  > ...
>  The call "transport.send(...)" calls the method "public static void
>  send(Message msg, Address[] addresses)". In the API documentation there
>  is the following comment for "public static void send(Message msg)"
>  method that most likely applies to the other static "send" method as
>  well:
>  "Note that send is a static method that creates and manages its own
>  connection. Any connection associated with any Transport instance used
>  to invoke this method is ignored and not used. This method should only
>  be invoked using the form Transport.send(msg);, and should never be
>  invoked using an instance variable."
>  This means that the username and password from the properties are
>  ignored, and that is the reason that the AuthenticationFailedException
>  occurs.
>  The solution for me is to replace the call
>  "transport.sendMessage(message, remainingAddresses);" instead of
>  "transport.send(message, remainingAddresses);". With that change email
>  notifications work in GlassFish.
>  Would this qualify as a general bug in Roller, or is this specific to
>  the combination with GlassFish?
>  Best Regards
>  Stephan

I love bug reports with suggested fixes!

I doubt that is a Glassfish specific bug, since you're effectively
bypassing the app
server by mail.configurationType=properties. If you file a bug report
I'll check it out
and get that fix in if appropriate.

- Dave

View raw message