dcsimg
Access to default session denied at javax.mail.session.getDefaultInstance
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   David_Ziebol
Posted On:   Friday, May 9, 2003 11:18 AM

Hi All I'm getting the defaultInstance from session and all is good for a few days. Then out to the blue I get an Access to default session denied at javax.mail.session.getDefaultInstance exception. This is being called from within a servlet running in Tomcat 4.0. Seems to be more time related then msg count related as I can send 100 msgs and not get the exception but then about 3 days later the exception will pop up again. Properties props = new Properties(); props.put("mail.smtp.host", MapsUtility.getConfiguration("Global", "MailServer")); // create some properties and get the default Session javax.mail.Session.javax.mail.   More>>

Hi All



I'm getting the defaultInstance from session and all is good for a few days. Then out to the blue I get an Access to default session denied at javax.mail.session.getDefaultInstance exception. This is being called from within a servlet running in Tomcat 4.0. Seems to be more time related then msg count related as I can send 100 msgs and not get the exception but then about 3 days later the exception will pop up again.




Properties props = new Properties();


props.put("mail.smtp.host", MapsUtility.getConfiguration("Global", "MailServer"));



// create some properties and get the default Session


javax.mail.Session.javax.mail.Session session =

javax.mail.Session.getDefaultInstance(props, new maps.mail.MapsAuthenticator());



session.setDebug(debug);
Transport transport = session.getTransport("smtp");



String userName = MapsUtility.getConfiguration("Global", "EmailUser");


String pass = MapsUtility.getConfiguration("Global", "EmailPass");


String host = MapsUtility.getConfiguration("Global", "MailServer");



transport.connect(host, userName, pass);



// compose the msg here and set necessary stuff



transport.sendMessage(msg, msg.getAllRecipients());
transport.close();




Any help would be greatly appreciated!

   <<Less

Re: Access to default session denied at javax.mail.session.getDefaultInstance

Posted By:   Kieran_Emmett  
Posted On:   Monday, May 19, 2003 01:42 AM

Hi Guys,


I have moved the code to my ISP and it now works fine by changing the getDefaultInstance to getInstance.



Cheers,


Kieran

Re: Access to default session denied at javax.mail.session.getDefaultInstance

Posted By:   Harsh_Sugandhi  
Posted On:   Thursday, May 15, 2003 10:28 PM

Hi David!

I am getting the same problem in sending the e-mail using the simmilar code. Have you got any solution for this?

One strange problem I am facing is when I test my code on my local machine then the authentication gets successful and e-mail is sent properly. But when I upload the same code on the web server then surprisingly the code stop running and gives the error - "Access to default session denied at javax.mail.session.getDefaultInstance".

What do you suggest? What may be the solution? Plz help me if you got soltion for this problem.

- Harsh Sugandhi
About | Sitemap | Contact