geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick McGuire <rick...@gmail.com>
Subject Re: Mailing from geronimo
Date Fri, 29 Sep 2006 10:36:31 GMT
Peter Petersson wrote:
> Hi all!
>
> I quite new to Geronimo (using 1.1.1) and have some problems geting 
> mail to work from a geronimo-quartz job.
> As I understand it I need to set up a gbean or do some other 
> configuration for javamail to work (?).
Yes, your application needs to have a dependency on the javamail config 
to ensure you're getting all of the correct jar files on your 
classpath.  The protocol problem you cite below is a symptom of not 
having that.  Adding the following to your deployment plan should be 
sufficient:

    <module name="org.apache.geronimo.configs/javamail/1.1.1/car"/>

That should be sufficient to get the classes on your classpath and allow 
you do drive everything from your code.  Additionally, you can do some 
basic session configuration in the plan (as opposed to keeping the 
configuration in your code) by using:

    <module name="org.apache.geronimo.configs/javamail/1.1.1/car">
        <gbean name="SMTPTransport">
            <attribute name="host">smtp.myisp.com</attribute>
            <attribute name="port">25</attribute>
        </gbean>
    </module>

Then in your application, create the mail Session instance using

    InitialContext ic = new InitialContext(); 
    Session mailSession = (Session) 
ic.lookup("java:comp/env/mail/MailSession");

When you request the transport instance from this session, this will 
pick up the SMTP configuration from the plan.

Rick


> The example i have folowed for the Quartz Scheduler Plugin over at 
> http://gplugins.sourceforge.net/ have a nice setup including mailing 
> (in the "Deployable Jobs Example" section) but it dose not go into 
> details on howto set up mailing (its not the scope of the example).
>
> What do I need to do to get it to work? as it is now i get this exception
>
> MessagingException Unable to locate provider for protocol: smtp
>
> Anny good pointer out there to get mailing working in Geronimo ?
>
> Cheers
>  Peter
>


Mime
View raw message