Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Using javamail for SMPTS on virgo fails on typo
Using javamail for SMPTS on virgo fails on typo [message #1071123] Fri, 19 July 2013 11:49 Go to next message
Maarten Winkels is currently offline Maarten Winkels
Messages: 11
Registered: May 2013
Junior Member
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 #1071152 is a reply to message #1071123] Fri, 19 July 2013 13:01 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta Georgieva
Messages: 238
Registered: October 2010
Senior Member
Hi,

Can't you use the official one [1].
I can see for example version 1.5 has OSGi meta data in the jar file.

Regards
Violeta

[1] http://mvnrepository.com/artifact/com.sun.mail/javax.mail
Re: Using javamail for SMPTS on virgo fails on typo [message #1071205 is a reply to message #1071152] Fri, 19 July 2013 14:54 Go to previous messageGo to next message
Maarten Winkels is currently offline Maarten Winkels
Messages: 11
Registered: May 2013
Junior Member
Hi,
Thanks for your reply.
I'm trying to use an official one, although not the latest version.
Now I'm running into problems with the DataHandlers, that are part of javax.annotation package.
Is there a solution for this problem? I find only solutions that involve repackaging the jars.

Thanks again!
-Maarten Winkels
Re: Using javamail for SMPTS on virgo fails on typo [message #1078740 is a reply to message #1071123] Sat, 03 August 2013 13:23 Go to previous messageGo to next message
Benoit Lafleche is currently offline Benoit Lafleche
Messages: 10
Registered: April 2011
Junior Member
I had the same problem after i upgraded from virgo 3.0 to 3.5. As virgo container the geronimo version.

I changed back to the com.springsource.javax.mail bundle version in the repository
/etc folder and that solved the problem.

Re: Using javamail for SMPTS on virgo fails on typo [message #1115214 is a reply to message #1078740] Mon, 23 September 2013 21:05 Go to previous message
Eduardo Frazão is currently offline Eduardo Frazão
Messages: 118
Registered: January 2012
Senior Member
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);
		}
	}

Previous Topic:Virgo Project Leadership
Next Topic:Is it possible to independently upgrade the version of Tomcat used by Virgo Tomcat?
Goto Forum:
  


Current Time: Sun Sep 21 14:13:39 GMT 2014

Powered by FUDForum. Page generated in 0.01734 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software