commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sanjeev Saha" <ss...@micropact.com>
Subject email - Unable to get session while in a Thread
Date Fri, 11 Nov 2005 20:26:07 GMT
Hello:

 

I am trying to send a SimpleEmail asynchronously through a thread using
commons-email-1.0 final release. The steps being used are:

 

1)      email = new Email() <-- this is a custom class which extends
SimpleEmail

2)      set all email related values on email

3)      thread = new EmailThread(email) <-- EmailThread extends Thread

4)      thread.start() <-- the run() in EmailThread calls email.send()

 

However, on closely scrutinizing the process, the statement:

            this.session =

                Session.getInstance(properties, this.authenticator);

 

in org.apache.commons.email.Email never returns (e.g. a
System.out.println("test") just after the stmt. doesn't print anything)
and the thread stops without sending the email. If debug is set on the
email object to 'true', the following is printed on the console:

 

DEBUG: JavaMail version 1.3

DEBUG: java.io.FileNotFoundException:
C:\myself\programs\java\1.4.2_08\jre\lib\javamail.providers (The system
cannot find the file specified)

DEBUG: !anyLoaded

DEBUG: not loading resource: /META-INF/javamail.providers

 

Interestingly,  if email.send() is called outside of the Thread, every
thing works fine.

 

Any ideas or suggestions would be wonderful.

 

Thanks,

Sanjeev


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message