• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MessagingException with Ant mail task

 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having trouble with the Ant mail task. Its giving the error message below.

Buildfile: C:\Java\workspace\hospital\build.xml
init:
zip_dev:
mail_dev:
[mail] Failed to initialise MIME mail: javax/mail/MessagingException
[mail] Sending email: Test build
[mail] Failed to send email

BUILD FAILED
C:\Java\workspace\hospital\build.xml:45: IO error sending mail

Total time: 7 seconds


this is the target:



I have searched on google, and some forums recommned placing mail.jar and activation.jar in %ANT_HOME%/lib which i have already done. (though, I'm using eclipse, so I placed these in /eclipse/plugins/%ANT_HOME%/lib)

please help!!
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My experience with eclipse is that it doesn't recognize that additional jars have been dropped into the ant home lib directory. You need to change the ant runtime configuration (under windows preferences on my version of eclipse).
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Carol. Please what exactly should I change in the runtime configuration?
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, I added the jars to Ant Home Entries under Ant Runtime, so now I'm no longer getting Exceptions, but the build still fails:

Buildfile: C:\Java\workspace\hospital\build.xml
init:
mail_dev:
[mail] Sending email: Test build
[mail] Failed to send email

BUILD FAILED
C:\Java\workspace\hospital\build.xml:44: Problem while sending mime mail:

Total time: 22 seconds

I wonder if there's a way to debug this?
Oh is the problem obvious?
 
Carol Enderlin
drifter
Ranch Hand
Posts: 1364
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the ant having problems? page, among other suggestions such as "read the manual":

Examine Debug Output

If you're still having a problem, the next step is to try and gather additional information about what Ant is doing. Try running Ant with the verbose flag:

ant -verbose

or

ant -v
 
kwame Iwegbue
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally works!!

Solution: Turns out that with Ant 1.6.5, exterrnal jars should not be placed under %ANT_HOME%\lib.

From Ant manual:

Prior to Ant 1.6, all jars in the ANT_HOME/lib would be added to the CLASSPATH used to run Ant...

...Additional directories to be searched may be added by using the -lib option. The -lib option specifies a search path. Any jars or classes in the directories of the path will be added to Ant's classloader. The order in which jars are added to the classpath is as follows:

* -lib jars in the order specified by the -lib elements on the command line
* jars from ${user.home}/.ant/lib (unless -nouserlib is set)
* jars from ANT_HOME/lib

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic