Solved

How to resolve Unhandled exception type javax.mail.MessagingException?

Posted on 2004-09-14
1
1,699 Views
Last Modified: 2013-11-24
How do I resolvethe MessagingException error for the program below  and at next to the last line"postEmailObject.postMail(recipients, subject, message, from);" is where I get a squigley line depicting an error.  In the Consle the the error reads java.lang.Error: Unresolved compilation problem:
      Unhandled exception type javax.mail.MessagingException

      at java.lang.reflect.Constructor.newInstance(Native Method)
      at xxx.xxx.xxx.xxx.TestMail.main(TestMail.java:24)(line 24  is different here because I excluded the package statement.  
Exception in thread "main"  
:
/**
 * @author tjw
 *
 * To change this generated comment edit the template variable "typecomment":
 * Window>Preferences>Java>Templates.
 * To enable and disable the creation of type comments go to
 * Window>Preferences>Java>Code Generation.
 */
public class TestMail {
      static String  setRay[]    = {"name@blah.com"};
      public static void main(String[] args) throws MessagingException {
            System.out.println("Begin TestSchedular");
      DocChangeChecker dockChg = new DocChangeChecker();
      String[] recipients =  setRay;
      String subject      = "Testing Batch Email frm a bat file";
      String message      = "Never fear Theodore is here";
      String from         = "name@blah.com";
      System.out.println("Past DocChangeChecker");
      //create the object first
      //then pass the arguments for the paramaters
      PostEmail postEmailObject = new PostEmail();
      postEmailObject.postMail(recipients, subject, message, from); //error here
        System.out.println("Past PostEmail");
      }
}
0
Comment
Question by:coolgem
1 Comment
 
LVL 3

Accepted Solution

by:
KeithWatson earned 250 total points
ID: 12058304
Have you the mail.jar and activation.jar included in the classpath? Both are required, assuming this is using the Javamail API behind your PostEmail class.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This is about my first experience with programming Arduino.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question