Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes mail servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "mail servlet" Watch "mail servlet" New topic
Author

mail servlet

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
I'm trying to create an emailing servlet. I've been getting this error running my mail.jsp that calls for my SendData servlet:
"java.lang.NoClassDefFoundError: javax/mail/Address"
when I do
mimeMessage.setFrom(internetAddrFrom);
but not when just
mimeMessage.setFrom();
Can anyone tell me how to get around this error or post a link for implementation example on how to build this sort of servlet? Thanks in advance.

P.S I'm using these these libraries:
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
I can only guess that java mail API libraries are not in your runtime class path. make sure that they are in web-inf/lib or in servlet container common libraries location. If you need a simple mail send I can give you very small class not requiring Java mail API.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Yes, Could you please post the class, or email it to me liliyaw@hotmail.com ? Liliya
Rashid Mayes
Ranch Hand

Joined: Jan 11, 2006
Posts: 160
Do you have a mail.jar? You need to make certain the jar files containging the mail classes are in your call path. You can add missing libraries to the WEB-INF/lib directory.


Rashid Mayes
http://www.hostj2me.com/ - http://www.worlddeveloper.org/
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Originally posted by liliya woland:
Yes, Could you please post the class, or email it to me liliyaw@hotmail.com ? Liliya
done.
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Thanks everyone. My libs were after all out of wack.
Dmitriy, thanks for the file, looks very promissing!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mail servlet