Peter Petersson wrote:
Thanks Rick for your quick response on my question.
Unfortunatly I can not use the syntax you suggest (below) as Im
working with a qeronimo-quartz plan
http://gplugins.sourceforge.net/schemas/geronimo-quartz-0.2.xsd
I'm afraid I don't have any experience with quartz, and there are a
number of things in that example that puzzle me. It would have been
nice if
they had showed the GBean configuration for their MailSession. Let's
try a couple of things (see below).
Basicly Im trying to figger out just how to translate what you points
me to in the context of this deploiment plan.
For instance dose the dependency injection of
<dependency>
<groupId>geronimo</groupId>
<artifactId>javamail</artifactId>
<version>1.1.1</version>
</dependency>
correspond to the module line below ? I tryed it out but still gets
the same error so i guess it dossent.
Try
<dependency>
<groupId>org.apache.geronimo.configs</groupId>
<artifactId>javamail</artifactId>
<version>1.1.1</version>
<type>car</type>
</dependency>
If that doesn't work, you might try creating your own example mail
session. I don't have a good copy of 1.1.1 on hand at the moment, so
I'm sort of shooting from the hip on the dependencies (they've changed
significantly in the current trunk build):
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.1">
<dep:environment
xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
<dep:moduleId>
<dep:groupId>example</dep:groupId>
<dep:artifactId>javamail-server</dep:artifactId>
</dep:moduleId>
<dep:dependencies>
<dep:dependency>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>geronimo-mail</dep:artifactId>
<dep:version>1.1.1</dep:version>
<dep:type>jar</dep:type>
<dep:import>classes</dep:import>
</dep:dependency>
<dep:dependency>
<dep:groupId>geronimo</dep:groupId>
<dep:artifactId>geronimo-javamail-transport</dep:artifactId>
<dep:version>1.1.1</dep:version>
<dep:type>jar</dep:type>
<dep:import>classes</dep:import>
</dep:dependency>
<dep:dependency>
<dep:groupId>org.apache.geronimo.configs</dep:groupId>
<dep:artifactId>rmi-naming</dep:artifactId>
<dep:type>car</dep:type>
</dep:dependency>
</dep:dependencies>
<dep:hidden-classes/>
<dep:non-overridable-classes/>
</dep:environment>
<gbean name="mail/MailSession" class="org.apache.geronimo.mail.MailGBean">
<attribute name="transportProtocol">smtp</attribute>
</gbean>
<gbean name="SMTPTransport"
class="org.apache.geronimo.mail.SMTPTransportGBean">
<attribute name="host">localhost</attribute>
<attribute name="port">25</attribute>
</gbean>
</module>
Cheers
Peter
Rick McGuire skrev:
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