tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Tonhofer, m-plify S.A." <d.tonho...@m-plify.com>
Subject Re: Sending mail with JavaMail
Date Fri, 07 Oct 2005 07:52:21 GMT
Did you add the Java Activation Famework jar to your WEB-INF/lib?

Check this out:

<http://java.sun.com/products/javabeans/glasgow/jaf.html>



--On Friday, October 07, 2005 9:33 AM +0200 Andrés Reyes <areyes@tcor.net> wrote:

> Hi. I need to send an email using a servlet (Tomcat 4.1 / Debian 3.1), but when I send
the form from the jsp page that call the servlet, i get this exception:
>
> javax.servlet.ServletException: Servlet execution threw an exception
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:222)
> 	at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:51)
> 	(...)
>
>
> *root cause*
>
> java.lang.NoClassDefFoundError: javax/activation/DataSource at AltaCliente.doPost(AltaCliente.java:63)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>
> This is the code of the servlet (which compiles with no problem):
>
> ---------------------------------
> import java.io.*;
> ...
> ...
>
> try {
>                         Properties props = new Properties();
>                         props.put("mail.smtp.host", "mail.***.***");
>                         Session s = Session.getInstance(props);
>                         MimeMessage message = new MimeMessage(s);
>
>                         InternetAddress from = new InternetAddress("areyes@****.***");
>                         message.setFrom(from);
>                         InternetAddress to = new InternetAddress("******@****.***");
>                         message.addRecipient(Message.RecipientType.TO, to);
>
>                         message.setSubject("Prueba de JavaMail.");
>                         message.setText("Hola desde JavaMail ( y Tomcat ). ");
>
>                         Store store = s.getStore("pop3");
>                         store.connect("mail.****.***", "areyes@****.***", "areyes");
>
>                         Transport.send(message);
>                         store.close();
>  } catch ( MessagingException e ) {
>                         out.println("<h1>MessagingException: " + e.getMessage()
+ "</h1>");
> ...
> ...
> ---------------------------------
>
> The content of the /WEB-INF/web.xml is ok (only describe the servlet and others that
I use), and the xml configuration for the context is:
> ---------------------------------
> <Context path="/*****" docBase="/usr/share/tomcat4/server/webapps/******"
>         debug="0" privileged="false">
>  <Resource name="mail/Session" scope="Shareable" type="javax.mail.Session"/>
>           <ResourceParams name="mail/Session">
>             <parameter>
>               <name>mail.smtp.host</name>
>               <value>mail.****.****</value>
>             </parameter>
>           </ResourceParams>
>
> </Context>
> ---------------------------------
>
> Thanks in advance.
>
> --
> /***********************************
> * Andrés Reyes ( areyes@tcor.net )
> * TCOR Desarrollos y Sistemas, S.L.
> * Teléfono: 957 76 42 48 * Fax     : 957 76 42 49
> ***********************************/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>



-- David Tonhofer

   M-PLIFY S.A.
   Resp. Informatique
   47, av. de la Liberté
   L-1931 Luxembourg
   Tel: +352 261846-52
   Fax: +352 261846-46
   Mob: +352 021-139031


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message