Re: JavaMail/JMTA help request
Re: JavaMail/JMTA help request
- Subject: Re: JavaMail/JMTA help request
- From: Colin Clark <email@hidden>
- Date: Wed, 3 Nov 2004 11:26:46 -0500
Hi Nathan,
Off the top of my head it looks like you aren't including the necessary
jars in your classpath properly. There are several ways to link to your
jars. Here are two easy ways:
1. Include the requisite JavaMail and JMTA jars in your Java extensions
folder. On Mac OS X, this is located in /Library/Java/Extensions.
2. Add the Jar to your project. Merge the contents of the jar with your
project by going to the Targets tab, choosing the Application Server
target, selecting Frameworks & Libraries, and clicking the "Merge"
checkbox for your jar.
I hope that helps,
Colin
---
Colin Clark
Dynamic Web and Database Development Lead,
Resource Centre for Academic Technology,
University of Toronto
On Tuesday, October 26, 2004, at 03:48 PM, Nathan Dumar wrote:
Would someone please help me get javamail working? I've read
everything I can find about all of it (which for JMTA is next to
nothing). The code I have so far is:
import javax.mail.*;
import javax.mail.internet.*;
import javax.mail.Session;
import java.util.*;
import alt.dev.jmta.*;
public class STMailer {
public static void sendSTMessage(String from, String to, String
subject, String body) {
Properties props = new Properties();
Session session = Session.getInstance(props);
try {
Message aMessage = new MimeMessage(session);
aMessage.setFrom(new InternetAddress(from));
aMessage.addRecipient(Message.RecipientType.TO, new
InternetAddress(to));
aMessage.setSubject(subject);
aMessage.setText(body);
// according to JMTA doc, following line should send message
JMTA.send(aMessage); // this is line 27 that the error references
} catch (MessagingException mex) { System.out.println(mex); }
return;
}
}
This code spits out the following error:
com.webobjects.foundation.NSForwardException for
java.lang.NoClassDefFoundError: javax/mail/Transport
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at STMailer.sendSTMessage(STMailer.java:27)
at Main.sendMessage(Main.java:122)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
va:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
rImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
KeyValueCodingProtectedAccessor.methodValue(KeyValueCodingProtectedAcce
ssor.java:54)
at
com.webobjects.foundation.NSKeyValueCoding$_MethodBinding.valueInObject
(NSKeyValueCoding.java:1160)
at
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.valueF
orKey(NSKeyValueCoding.java:1268)
at
com.webobjects.appserver.WOComponent.valueForKey(WOComponent.java:1539)
at
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyVal
ueCoding.java:498)
...
Thank you,
Nathan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden