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("[EMAIL PROTECTED]");
message.setFrom(from);
InternetAddress to = new
InternetAddress("[EMAIL PROTECTED]");
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.****.***",
"[EMAIL PROTECTED]", "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 ( [EMAIL PROTECTED] )
* TCOR Desarrollos y Sistemas, S.L.
* Teléfono: 957 76 42 48
* Fax : 957 76 42 49
***********************************/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]