On 6/11/07, David Weintraub <[EMAIL PROTECTED]> wrote:
I have a very straight forward build.xml file:<project name="test" default="test" basedir="."> <target name="test"> <mail from="[EMAIL PROTECTED]" subject="Test Email" mailhost="192.168.128.100" user="dweintraub" password="xxxxxxxx" message="This is a test email" failonerror="true"> <to name="David Weintraub" address="[EMAIL PROTECTED]"/> </mail> </target> </project> When I attempt to execute it, I get the following error message: test: [mail] Failed to initialise MIME mail: javax/mail/MessagingException BUILD SUCCESSFUL
--- Looking at the source code: src/main/org/apache/tools/ant/taskdefs/email/EmailTask
Which is strange because I set "failonerror" to "true".
This is a bug. The code does not check the failonerror flag here and simply returns.
[mail] Failed to initialise MIME mail: javax/mail/MessagingException
This is due to "helpful" code in EmailTask, a buildexception is thrown by classloader utilities - "Class org.apache.tools.ant.taskdefs.email.MimeMailer could not be loaded because of an invalid dependency." with a cause exception: Caused by: java.lang.ClassNotFoundException: javax.mail.MessagingException however EmailTask#logBuildException() only reports the message in the cause by exception (javax.mail.MessagingException). The root cause that can give this exception is a missing javamail[anyversion].jar file. you seem to be having problems getting the javamail.jar into the right place (whatever ANT_HOME/lib that is used by cruise control ?). Try at the command line. (NOTE: for linux users, if you installed the jpackage version of ant, the file /etc/ant.conf will override ANT_HOME for pre ant 1.7.0). In the mean time, you can use the excellent classloader task to add the javamail.jar to your project classloader: from http://enitsys.sourceforge.net/ant-classloadertask/ <typedef uri="antlib:net.jtools.classloadertask" resource="net/jtools/classloadertask/antlib.xml"> <classpath> <fileset dir="${user.home}/tools/ant-classloader" includes="*.jar"/> </classpath> </typedef> <cl:classloader loader="project"> <classpath> <fileset dir="${user.home}/tools/javamail/" includes="*.jar"/> </classpath> </cl:classloader> <mail ...> Peter
Any ideas? I am currently sending mail via CruiseControl and that works (and where I got the parameters from) so I know that it is possible to send email from this machine.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
