I found lot of problems when trying to send an email through java.
The first time I recompiled and restarted my application everything seems to work fine.
At the first time my application was able to correctly send an email to the desired e-mail address. Once this email was sent, there was no hope to resend another email to another (or same) address.
The stack trace said:
[Java>JavaMail] java.lang.SecurityException: "Access to default session denied" occures.
And lot of error messages...The stack trace said that the error was at the line in which my application perform the call to the send mail code class.
Here is the problem.
This error is raised in the getDefaultInstance method in javax.mail.Session.java. According.It occurs when this session has been already initialized, used or recharged recompiling the whole application everything work...
HOW TO FIX THIS PROBLEM?
Well, it's very simple write a singleton class for the send mail code class and everything works perfectly!
No comments:
Post a Comment