Results 1 to 3 of 3
  1. #1
    bbq
    bbq is offline Senior Member
    Join Date
    Jun 2007
    Posts
    132
    Rep Power
    0

    Default java.lang.NoClassDefFoundError: javax/activation/DataSource

    I’m trying to learn javamail. I did a web page to test it.
    my code:
    Java Code:
    import java.util.Properties;
    import javax.mail.*;
    import javax.mail.internet.*;
    
    public class Sendemail {
    
    public static void main(String [] args) {
    
    String from="carcaharas@hotmail.com";
    
    String to="carcaharas@yahoo.com";
    
    //String smtpHost = "smtp.auna.com";
    Properties props = System.getProperties();
    props.put("mail.smtp.host", "smtp.ono.com");
    Session sesion = Session.getDefaultInstance(props,null);
    
    try {
    Message message = new MimeMessage(session);
    
    message.setSubject("Hello world");
    message.setFrom(new InternetAddress(from));
    message.addRecipient( Message.RecipientType.TO,
    new InternetAddress(to));
    message.setText("this is the body of the message ");
    Transport.send(message);
    } catch (MessagingException e) {
    System.error.println(e.getMessage());
    }
    }
    }
    and the error is:
    Java Code:
    java.lang.NoClassDefFoundError: javax/activation/DataSource
    Exception in thread "main"
    the problem is in the line

    Java Code:
    Message message = new MimeMessage(session);
    any ideas?

  2. #2
    Jack is offline Senior Member
    Join Date
    Jun 2007
    Posts
    130
    Rep Power
    0

  3. #3
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: java.lang.NoClassDefFoundError: javax/activation/DataSource

    Spam resurrection of zombie thread. Locking

Similar Threads

  1. Replies: 2
    Last Post: 01-20-2014, 07:45 AM
  2. java.lang.NoClassDefFoundError: com.ibm.ws.orb.GlobalORBFactory
    By hawkeye in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 06-16-2008, 10:56 AM
  3. java.lang.NoClassDefFoundError
    By J_a_y in forum New To Java
    Replies: 2
    Last Post: 08-07-2007, 11:51 AM
  4. java.lang.NoClassDefFoundError
    By fred in forum Advanced Java
    Replies: 3
    Last Post: 08-01-2007, 05:00 PM
  5. Replies: 1
    Last Post: 07-23-2007, 11:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •