sending mail problems

Hi

I have this program that it works independetly but when I create an object from it from another program, it doesn't go through after the creation of the session.It stops atMessage msg = new MimeMessage(session); can some one help me and tell me the problem .thanks

import java.io.PrintWriter;

import java.util.*;

import javax.mail.*;

import javax.mail.internet.*;

import javax.activation.DataHandler;

import javax.activation.FileDataSource;

public class Test3 {

public void send(String to,String from,String message){

String cc = "";

String bcc = "";

String host = "smtp-gw.fr.world.socgen";

Properties props = new Properties();

props.put("mail.smtp.host", host);

props.put("mail.debug", "true");

try {

Session session = Session.getInstance(props);

// Here is the problem when it doesn't go throught

Message msg = new MimeMessage(session);

msg.setFrom(new InternetAddress(from));

InternetAddress[] address = {new InternetAddress(to)};

msg.setRecipients(Message.RecipientType.TO,address);

if(cc !=null)

{msg.setRecipients(Message.RecipientType.CC,

InternetAddress.parse(cc,true));}

if(bcc !=null)

{msg.setRecipients(Message.RecipientType.BCC,

InternetAddress.parse(bcc,true));}

msg.setSubject("Error Message");

msg.setSentDate(new Date());

msg.setContent(message, "text/plain");

Transport.send(msg);

System.out.println("yes");

}

catch (MessagingException ex){

System.err.println("Cannot send the email. " + ex);

}

}

}

[1670 byte] By [bronze-starDukes] at [2007-11-26 12:10:09]
# 1
What are the errors?Use code tags!
silverstar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...
# 2
Stops?Are you getting an exception?
silverstar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...
# 3
when I use the step into , it doesn't go through this phase.and as I am accessing this variable through a servlet, tomcat exception is shown on the screen.
bronzestar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...
# 4
> when I use the step into , it doesn't go through this> phase.and as I am accessing this variable through a> servlet, tomcat exception is shown on the screen.Again, please post the details. Stop trying to make us guess what exceptions are happening.
silverstar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...
# 5

The error that I am getting is :

javax.servlet.ServletException: Servlet execution threw an exception

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

root cause

java.lang.NoClassDefFoundError: javax/activation/DataSource

test3.send(test3.java:48)

Password.doGet(Password.java:137)

javax.servlet.http.HttpServlet.service(HttpServlet.java:689)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

and I have already imported the javax.activation.*

Thanks in advance

bronzestar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...
# 6
> and I have already imported the javax.activation.*You don't need to import it. You need to download activation.jar and put it into your classpath. The Java Mail API depends on it. http://java.sun.com/products/javabeans/jaf/downloads/index.html
silverstar at 2007-7-7 13:47:57 > top of Java-index,Archived Forums,Socket Programming...