Microsoft
Software
Hardware
Network
Question : NoClassDefFoundError: javax/mail/Address
Hi,
I am a newbee on here so I am asking this question with high hopes, but also in a bit of desperation!
I have seen several posts on this site with similar Question Titles. I have read the answers thoroughly and double checked them against my set up but I still have the problem.
I am trying to implement a small Java email application (as a small part of a much larger development). The code includes (amongst other things) the following:
import javax.mail.*;
import javax.mail.internet.MimeMe
ssage;
import javax.mail.internet.Intern
etAddress;
public class Email {
public boolean send (String sessionid) {
Properties props;
props = new Properties();
Session session;
session = Session.getDefaultInstance
(props, null);
MimeMessage message;
message = new MimeMessage(session);
message.setContent("Hello ;-)", "text/plain");
message.setSubject("zRules
Email Test");
Address fromaddress;
Address toaddress[] = null;
Address ccaddress[] = null;
Address bccaddress[] = null;
Address replyaddress[] = null;
fromaddress = new InternetAddress("user@user
.com");
toaddress[0] = new InternetAddress("user@user
.com");
replyaddress[0] = new InternetAddress("user@user
.com");
message.setFrom(fromaddres
s);
message.setReplyTo(replyad
dress);
message.addRecipients(Mess
age.Recipi
entType.TO
, toaddress);
// ... at which point I am ready to transport the message
}
}
I am developing the application using IntelliJ Idea, which has no problem compiling the source code, but when I try to use it in Tomcat, I get the error: java.lang.NoClassDefFoundE
rror: javax/mail/Address
I have checked my environment variables and the following two entries exist in both CLASSPATH and JAVA_HOME:
C:\Program Files\Java\jre6\lib\ext\ja
vamail-1.4
.3;
C:\Program Files\Java\jre6\lib\ext\ja
vamail-1.4
.3\mail.ja
r
Needless to say I have also downloaded JavaMail and the mail.jar file is sitting in the folder C:\Program Files\Java\jre6\lib\ext\ja
vamail-1.4
.3. I also made sure I copied all the other files that are part of the JavaMail zip file; they are dsn.jar, imap.jar, mailapi.jar, pop3.jar and smtp.jar and they all sit in the C:\Program Files\Java\jre6\lib\ext\ja
vamail-1.4
.3\lib folder.
After checking the environment variables I rebooted and I still get the error. Is there something special I need to do to get Tomcat to see this class? I have no hair left and am a trembling wreck! Please help?!
Related Solutions:
Javamail - NoClassDefFoundError: javax/mail/Address
Answer : NoClassDefFoundError: javax/mail/Address
Closing question - no responses.
Random Solutions
Outlook not attack shortcut (lnk) attach directly the file
Blackberry Enterprise Server Express, MAPI subsystem error
How to alter tablespace paramter SEGMENT SPACE MANAGEMENT manual to auto in oracle
Replace Windows 2003 DC with a new Windows 2008 DC
I am looking forward to learn about JSF with ICEfaces
XP Pro SP3 on Dell Inspiron 9400 notebook with OCZ SSD: BSOD 0xF4 after resume from standby
HP EVA MPIO from Windows 2008 R2
My laptop hp pavilion dv9000 suddenly doesnt start
Raid 1 Rebuild Failed - Adaptec 1210SA
Clear Move Request (moverequest) matches multiple entries