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

二次信任 提交于 2019-12-03 09:51:51

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.

I've got the same error, when I launch 2 tests in Webdriver. In secound test i've got "java.lang.SecurityException: Access to default session denied".

When I used method Session.getInstance instead Session.getDefaultInstance in every test, errors disappeared.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!