Using OpenJDK 1.7.0 and GNU JavaMail 1.1.2.
During the actual message send call:
SMTPTransport.send(msg);
This happens:
javax.mail.NoSuchProviderException: No provider for address: rfc822
at javax.mail.Session.getTransport(Session.java:641)
at javax.mail.Transport.doSend(Transport.java:149)
at javax.mail.Transport.send(Transport.java:75)
Transport.send(msg) produces the same result.
I'm pretty sure my classpath is OK. Here's how it's defined in build.xml in the JAR task:
<zipfileset src="${sys}/inetlib.jar" includes="**/*.java **/*.class"/>
<zipfileset src="${sys}/gnumail-providers.jar" includes="**/*.java **/*.class"/>
<zipfileset src="${sys}/gnumail.jar" includes="**/*.java **/*.class"/>
Where ${sys} is /usr/share/java. Am I going to have to suck it up and use the Oracle JavaMail API?
I got the same problem as you and it happened to be caused by the jar
geronimo-javamail_1.4_spec
messing things up. A simple solution is to exclude it from your dependencies. With Maven, assuming it's a dependency from CXF:As to know exactly why, I did not took the time to investigate further. It's a multi-thread safety bug for sure (I got it when multiple threads where speaking SMTP at the same time).
Original reference of the solution here.
It looks like your program is trying to set rfc822 as the domain address to be used for the transport layer. Is this a valid address? I suggest searching your code for this reference as the problem is undoubtedly around that area.