You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by NR031 <na...@cognizant.com> on 2009/03/16 08:03:56 UTC

Sending mails from ant script

Hi,

   I am getting NoClassDeffound exception when I tried to send mails. This
is my code :

<target name="email">
        <mail mailhost="localhost" mailport="9080" tolist="xyz@abc.com"
from="NR" message="Success"/>
    </target>

and this is what I am getting:

email:
Sending email: null
java.lang.NoClassDefFoundError: javax/mail/MessagingException
        at
org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer.java:155)
        at
org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:535)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
        at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:357)
        at org.apache.tools.ant.Target.performTasks(Target.java:385)
        at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
        at
org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
        at
org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
        at
org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
BUILD FAILED (total time: 0 seconds)


I included mail and activation.jar into ant_home/lib path.

-- 
View this message in context: http://www.nabble.com/Sending-mails-from-ant-script-tp22532772p22532772.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Sending mails from ant script

Posted by David Weintraub <qa...@gmail.com>.
I got a similar error, and yet the mail was still sent. My experience
with the mail.jar is that it is buggy and works spottily.

I am sure this is not what you wanted to hear, but at least you know
that other people have had similar issues.

You might be better off using a script to fire off your mail instead
of using this task. On Unix, it's pretty easy to replace this with the
"mail" command. On Windows, you can try blat <http://www.blat.net/>,

Normally, I would be against using a command when a perfectly good Ant
target is around. However, not only is this spotty, it isn't even
included in the stanard Ant installation anyway.

On Mon, Mar 16, 2009 at 3:03 AM, NR031 <na...@cognizant.com> wrote:
>
> Hi,
>
>   I am getting NoClassDeffound exception when I tried to send mails. This
> is my code :
>
> <target name="email">
>        <mail mailhost="localhost" mailport="9080" tolist="xyz@abc.com"
> from="NR" message="Success"/>
>    </target>
>
> and this is what I am getting:
>
> email:
> Sending email: null
> java.lang.NoClassDefFoundError: javax/mail/MessagingException
>        at
> org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer.java:155)
>        at
> org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:535)
>        at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>        at sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
>        at org.apache.tools.ant.Task.perform(Task.java:348)
>        at org.apache.tools.ant.Target.execute(Target.java:357)
>        at org.apache.tools.ant.Target.performTasks(Target.java:385)
>        at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>        at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>        at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>        at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>        at
> org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
>        at
> org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
>        at
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
> BUILD FAILED (total time: 0 seconds)
>
>
> I included mail and activation.jar into ant_home/lib path.
>
> --
> View this message in context: http://www.nabble.com/Sending-mails-from-ant-script-tp22532772p22532772.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: Sending mails from ant script

Posted by NR031 <na...@cognizant.com>.
Yes, it contains the MessagingException class
------------------------------------------------------------------------------------------------------

Jan.Materne wrote:
> 
> Does your ant_home/lib/mail.jar contain the class
> javax.mail.MessagingException?
> 
> Jan
> 
>> -----Ursprüngliche Nachricht-----
>> Von: NR031 [mailto:nataraja.cp@cognizant.com] 
>> Gesendet: Montag, 16. März 2009 08:04
>> An: user@ant.apache.org
>> Betreff: Sending mails from ant script
>> 
>> 
>> Hi,
>> 
>>    I am getting NoClassDeffound exception when I tried to 
>> send mails. This
>> is my code :
>> 
>> <target name="email">
>>         <mail mailhost="localhost" mailport="9080" 
>> tolist="xyz@abc.com"
>> from="NR" message="Success"/>
>>     </target>
>> 
>> and this is what I am getting:
>> 
>> email:
>> Sending email: null
>> java.lang.NoClassDefFoundError: javax/mail/MessagingException
>>         at
>> org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer
>> .java:155)
>>         at
>> org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTas
>> k.java:535)
>>         at
>> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>>         at 
>> sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
>>         at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
>> odAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>         at
>> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUt
>> ils.java:105)
>>         at org.apache.tools.ant.Task.perform(Task.java:348)
>>         at org.apache.tools.ant.Target.execute(Target.java:357)
>>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>>         at
>> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>>         at 
>> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>>         at
>> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(Def
>> aultExecutor.java:41)
>>         at 
>> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>>         at
>> org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeI
>> mpl.java:277)
>>         at
>> org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecu
>> tor.java:460)
>>         at
>> org.netbeans.core.execution.RunClassThread.run(RunClassThread.
>> java:151)
>> BUILD FAILED (total time: 0 seconds)
>> 
>> 
>> I included mail and activation.jar into ant_home/lib path.
>> 
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Sending-mails-from-ant-script-tp22532772
>> p22532772.html
>> Sent from the Ant - Users mailing list archive at Nabble.com.
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Sending-mails-from-ant-script-tp22532772p22533732.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: Sending mails from ant script

Posted by Ja...@rzf.fin-nrw.de.
Does your ant_home/lib/mail.jar contain the class javax.mail.MessagingException?

Jan

> -----Ursprüngliche Nachricht-----
> Von: NR031 [mailto:nataraja.cp@cognizant.com] 
> Gesendet: Montag, 16. März 2009 08:04
> An: user@ant.apache.org
> Betreff: Sending mails from ant script
> 
> 
> Hi,
> 
>    I am getting NoClassDeffound exception when I tried to 
> send mails. This
> is my code :
> 
> <target name="email">
>         <mail mailhost="localhost" mailport="9080" 
> tolist="xyz@abc.com"
> from="NR" message="Success"/>
>     </target>
> 
> and this is what I am getting:
> 
> email:
> Sending email: null
> java.lang.NoClassDefFoundError: javax/mail/MessagingException
>         at
> org.apache.tools.ant.taskdefs.email.MimeMailer.send(MimeMailer
> .java:155)
>         at
> org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTas
> k.java:535)
>         at
> org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>         at 
> sun.reflect.GeneratedMethodAccessor86.invoke(Unknown Source)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMeth
> odAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at
> org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUt
> ils.java:105)
>         at org.apache.tools.ant.Task.perform(Task.java:348)
>         at org.apache.tools.ant.Target.execute(Target.java:357)
>         at org.apache.tools.ant.Target.performTasks(Target.java:385)
>         at
> org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
>         at 
> org.apache.tools.ant.Project.executeTarget(Project.java:1298)
>         at
> org.apache.tools.ant.helper.DefaultExecutor.executeTargets(Def
> aultExecutor.java:41)
>         at 
> org.apache.tools.ant.Project.executeTargets(Project.java:1181)
>         at
> org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeI
> mpl.java:277)
>         at
> org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecu
> tor.java:460)
>         at
> org.netbeans.core.execution.RunClassThread.run(RunClassThread.
> java:151)
> BUILD FAILED (total time: 0 seconds)
> 
> 
> I included mail and activation.jar into ant_home/lib path.
> 
> -- 
> View this message in context: 
> http://www.nabble.com/Sending-mails-from-ant-script-tp22532772
> p22532772.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org