Skip to main content

javaMail: Access to default session denied ??

1 reply [Last post]
Anonymous

There is an exception when I try to access the JavaMail session:

java.lang.SecurityException: Access to default session denied
at javax.mail.Session.getDefaultInstance(Session.java:321)

the code:

Properties sessionProps = javaMailSession.getProperties();
pipedUsername = sessionProps.getProperty("mail.user");
pipedPassword = sessionProps.getProperty("mail.smtp.password");

Session session = Session.getDefaultInstance(sessionProps,
new Authenticator() {
public PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
pipedUsername, pipedPassword);
}
});

any idea ?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Felipe Gaúcho

solved,

Session.getDefaultInstance >>> Session.getInstance

and it do the job :)

http://forums.sun.com/thread.jspa?threadID=5301696

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net