Using javamail for SMPTS on virgo fails on typo [message #1071123] |
Fri, 19 July 2013 07:49  |
Eclipse User |
|
|
|
Hi,
I'm trying to use javamail on Virgo to send a message over SMTPS. This fails with the following exception:
Quote:
TC0010I org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: Unable to load class for provider: protocol=smtps; type=javax.mail.Provider$Type@4641b972; class=org.apache.geronimo.javamail.transport.smtp.SMTPTSransport; vendor=Apache Software Foundation;version=1.0. Failed messages: javax.mail.NoSuchProviderException: Unable to load class for provider: protocol=smtps; type=javax.mail.Provider$Type@4641b972; class=org.apache.geronimo.javamail.transport.smtp.SMTPTSransport; vendor=Apache Software Foundation;version=1.0;
At first look this looks like a classloader issue, but closer inspection reveals a typo in the name: org.apache.geronimo.javamail.transport.smtp.SMTPTSransport
should be
org.apache.geronimo.javamail.transport.smtp.SMTPSTransport
This is actually a known bug in a very old version of geronimo: https://issues.apache.org/jira/browse/GERONIMO-6167
These classes are loaded from javax.mail_1.4.0.v201005080615.jar which is in repository/ext of the Virgo distribution.
Replacing this jar with a newer version should solve the problem, but I cannot find a correct version anywhere.
Can this be updated? Where should I find these jars?
Thanks!
Regards, Maarten Winkels
|
|
|
|
|
|
Re: Using javamail for SMPTS on virgo fails on typo [message #1115214 is a reply to message #1078740] |
Mon, 23 September 2013 17:05  |
Eclipse User |
|
|
|
Here im using javax.mail 1.4.0.v201005080615
The default one, that comes with Virgo 3.6.2
I'm using apache Commons Mail Facade API too.
To create Multipart emails, with attachments, etc, I got some problems, and I solved it in this way:
-- Ive created a EmailService Facade
public EmailServiceImpl() {
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(mc);
}
And, to send emails:
public void send(Email email, EmailAccount account) {
final ClassLoader tcl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(javax.mail.Session.class.getClassLoader());
org.apache.commons.mail.Email e = createImplEmail(email, account);
e.send();
}
catch (Exception e) {
logSevere("Unable to send", e);
throw new DomainException("exceptionI18nID", "Unable to send");
} finally {
Thread.currentThread().setContextClassLoader(tcl);
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.06288 seconds