Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java mail api : exception thrown saying java.lang.SecurityException: Access to default session denied

Tags:

when im trying to send a mail using java mail api in my web application , I'm getting this exception.

java.lang.SecurityException: Access to default session denied

the inputs are fron an html page. then it goes to a servlet which eventually calls a java class where the mail logic is written

like image 735
user1506349 Avatar asked Jul 19 '12 18:07

user1506349


1 Answers

This error text is associated with a call to Session.getDefaultInstance(props, authenticator) where the default instance already has a different authenticator set.

It should work better if you call Session.getInstance(props, authenticator) instead of Session.getDefaultInstance(props, authenticator) in your code.

like image 178
dkarp Avatar answered Oct 11 '22 23:10

dkarp