Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

NoSuchProviderException

621312Dec 16 2010 — edited Jan 3 2011
Hi,
I know this is discussed a lot of times in the forum. my case is a bit different, any sort of help is appreciated.

I use activation.jar and mail.jar for sending emails for my application. I am not getting emails in certain cases. The same code is used for sending emails for all the application interfaces. Only in certain cases, i get the following error,

javax.mail.NoSuchProviderException: Invalid protocol :null

This is the code i use,

Properties sessionConfig = new Properties();
sessionConfig.put("mail.transport.protocol",
"smtp");
System.out.println("smtphost "+smtpHost);
sessionConfig.put("mail.smtp.host",
smtpHost);
sessionConfig.put("from",
"from");
sessionConfig.put("body",
"No body for this message.");
sessionConfig.put("subject",
"No subject for this message.");
_session = Session.getDefaultInstance(sessionConfig, null);
transport = _session.getTransport();
transport.connect();
transport.sendMessage(transportMessage,...

this issue happens only in certain cases. And the protocol is set properly.



More info : I am using mail.jar version 1.4.1
JAF version 1.1
jdk 1.6

i have learnt that the use of JAF is not needed if we use jdk1.6 . but this setup is present for a long time and i am facing this issue frequently and randomly only in recent times.

regards,
Aravind
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 31 2011
Added on Dec 16 2010
1 comment
153 views