执行ant邮件任务时收到错误消息"java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage"



我试图执行下面提到的ant邮件任务,我收到错误消息:java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage

我为蚂蚁创建了环境变量。

还放置了mail.jar、activationjar&在lib文件夹中以及在eclipse -> preferences -> Global Entries中的ant javamail jar。执行ant邮件任务还需要什么?请提出建议。

<target description="Generates and send TestNG test reports" name="send-report">
    <mail mailhost="smtp.sears.com" mailport="25" user="kmartvlakshm" password="AK230211$$" ssl="true" subject="Test build">
    <from address="vijayalakshmi.lakshmanan@searshc.com"></from>
     <replyto address="vijayalakshmi.lakshmanan@searshc.com"></replyto>
     <to address="vijayalakshmi.lakshmanan@searshc.com"></to>
     <message>Please find the attached report for Sears International smoke test results.</message>
         <attachments>
           <fileset dir="C:\Documents and Settings\vlakshm\workspace\INTL_REG\test-output\emailable-report.html">
            <include name="**/*.zip"/>
           </fileset>
         </attachments>
      </mail>
    </target>

在命令提示符下,执行下面提到的命令

ant send-report

获得下面提到的异常

build.xml:70: java.lang.ClassNotFoundException: javax.mail.internet.MimeMessage
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.apache.tools.ant.taskdefs.email.EmailTask.execute(EmailTask.java:
452)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:435)
        at org.apache.tools.ant.Target.performTasks(Target.java:456)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
        at org.apache.tools.ant.Main.runBuild(Main.java:851)
        at org.apache.tools.ant.Main.startAnt(Main.java:235)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Total time: 0 seconds

在ANT_HOME/lib中添加mail.jar和activation.jar,或者在项目/lib中同时使用这两个jar

相关内容

  • 没有找到相关文章

最新更新