Meu enviarMail dá um erro

6 respostas
P
erro:java.lang.NoClassDefFoundError: javax/activation/DataSource

at SendMail.send(SendMail.java:25)

at Carteiro.<init>(Carteiro.java:75)

at Carteiro.main(Carteiro.java:60)

Exception in thread main

alguma sugestão?

eis a classe:
/*

  • @(#)msgsend.java 1.17 03/04/22
  • Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
  • Redistribution and use in source and binary forms, with or without
  • modification, are permitted provided that the following conditions
  • are met:
    • Redistributions of source code must retain the above copyright
  • notice, this list of conditions and the following disclaimer.
    • Redistribution in binary form must reproduce the above copyright
  • notice, this list of conditions and the following disclaimer in the
  • documentation and/or other materials provided with the distribution.
  • Neither the name of Sun Microsystems, Inc. or the names of contributors
  • may be used to endorse or promote products derived from this software
  • without specific prior written permission.
  • This software is provided “AS IS,” without a warranty of any kind. ALL
  • EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
  • INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
  • PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND
  • ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR LIABILITIES
  • SUFFERED BY LICENSEE AS A RESULT OF OR RELATING TO USE, MODIFICATION
  • OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
  • SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
  • FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
  • DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
  • ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS
  • BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  • You acknowledge that Software is not designed, licensed or intended
  • for use in the design, construction, operation or maintenance of any
  • nuclear facility.
    */
import <a href="http://java.io">java.io</a>.*;

import java.net.InetAddress;

import java.util.Properties;

import java.util.Date;

import javax.mail.;
import javax.mail.internet.
;

/**

  • Demo app that shows how to construct and send an RFC822
  • (singlepart) message.
  • XXX - allow more than one recipient on the command line
  • @author Max Spivak
  • @author Bill Shannon
    */

public class Carteiro {

public static void main(String[] argv) {
new Carteiro(argv);
}

public Carteiro(String[] argv) {
//		properties.loadProperties(“sce.properties”);

//		String smtp = properties.getProperty(“mail.host”);

String smtp = dsc.ufcg.edu.br;

String from = [email removido];

String to = from;

/*		String mail = ((SolicitarCadastroForm) form).getMail();

String nome = ((SolicitarCadastroForm) form).getNome();

String matricula = ((SolicitarCadastroForm) form).getMatricula();*/

String message = Teste de envio;
try {
		SendMail.send(smtp, from, to, message);
	} catch (AddressException e) {
		e.printStackTrace();
	} catch (MessagingException e) {
		e.printStackTrace();
	}
}

}

6 Respostas

Rafael_Steil

Voce precisa ter o Activation.jar tambem. Pegue ele em

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

Soh lembrando que o forum ja tem algumas dezenas de mensagens sobre javamail. Voce pode ir na opcao “Busca” e digitar “javamail” ou “java email” que na esmgadora maioria dos casos ja vai ter a solucao para os problemas :wink:

Rafael

P

obg amigo :slight_smile: funfou…

rogeriop80

Rafael Steil:
Voce precisa ter o Activation.jar tambem.
Rafael

Agora porque raios eles não incluem esse cara no pacote do javamail ?!
:-/

[]´s

Rafael_Steil

Pq isso cria um jar hell ;). Porem, deveria estar mais claro / explicito na pagina do javamail que existe essa dependencia.

Rafael

rogeriop80

Rafael Steil:
Pq isso cria um jar hell ;).
Rafael

Desculpe a ignorancia, mas o que eh um jar hell ?!?!? Jar dos Infernos ?!?!?

[]´s

Rogerio

Rafael_Steil

Eh voce ficar com tantos jars do mesmo framework / sistema / aplicativo que as coisas comecam a desandar, dando problemas de incompatiblidade e etc.

O JavaMail depende do Activation Framework, mas o correto de fato eh deixar o download separado, ja que sao projetos distintos.

Rafael

Criado 21 de maio de 2005
Ultima resposta 21 de mai. de 2005
Respostas 6
Participantes 3