My mistakes

java.lang.SecurityException: Access to default session denied

Posted on: July 31, 2012

SEVERE: Servlet.service() for servlet EmailServlet threw exception
java.lang.SecurityException: Access to default session denied

Please try the below solutions
1) Verify there is no duplication of javamail.jar in the tomcat or in your application.

Check the tomcat_home/lib , your_app/WEB-INF/lib

2)  Verify you are using only one email configuration to call the Session.getDefaultInstance through out the site.

Because as per the http://docs.oracle.com/javaee/6/api/javax/mail/Session.html#getInstance%28java.util.Properties documentation the replication of the configuration with getDefaultInstance will cause an error.

In such case if you want to insist with the new configuration then use Session.getInstance instead of Session.getDefaultInstance.

Advertisements
Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: