I am trying to send mail from an session bean on Jboss 4.0.4GA1.
My mail-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<!-- $Id: mail-service.xml,v 1.5.6.1 2005/06/01 06:20:43 starksm Exp $ -->
<!-- ==================================================================== -->
<!-- Mail Connection Factory -->
<!-- ==================================================================== -->
java:/Mail
nobody
password
<!-- Test -->
<!-- Change to your mail server prototocol -->
<!-- Change to the user who will receive mail -->
<!-- Change to the mail server -->
<!-- Change to the SMTP gateway server -->
<!-- Change to the address mail will be from -->
<!-- Enable debugging output from the javamail classes -->
jboss:service=Naming
The code in session bean looks like:
InitialContext ctx = new InitialContext() ;
Session mailSession = (Session) ctx.lookup("java:Mail") ;
Message msg = new MimeMessage(mailSession);
InternetAddress toAddrs[] = new InternetAddress[1];
toAddrs[0] = new InternetAddress("[EMAIL PROTECTED]");
msg.setRecipients(Message.RecipientType.TO, toAddr);
msg.setFrom();
msg.setSubject("Takeoff time.");
msg.setSentDate(new Date());
String content = new String("Test");
msg.setContent(content, "text/plain");
Transport.send(msg);
I am getting an error:
Caused by: java.lang.NoSuchMethodError:
javax.activation.DataHandler.(Ljava/lang/Object;Ljava/lang/String;)V
at javax.mail.internet.MimeMessage.setContent(MimeMessage.java:1380)
at
si.hit.ldap.ejb.session.LdapServerBean.sendMail(LdapServerBean.java:234)
Thanks in advance,
Damijan
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3967812#3967812
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3967812
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user