• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MessagingException with Ant mail task

 
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic