Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Security Manager refused file access

 
Qaisar Iqbal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using javax.mail API(1.2), bundled with the j2ee package, for an automated email generation of user registration,and getting the following exception

access denied (java.io.FilePermission /web/tomcat/work/hosting/www.myDomanName.com/_/loader/META-INF write)

The full stack trace is
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
java.security.AccessController.checkPermission(AccessController.java:427)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
java.io.File.mkdir(File.java:1119)
java.io.File.mkdirs(File.java:1148)
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1811)
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:920)
org.apache.catalina.loader.WebappClassLoader.getResourceAsStream(WebappClassLoader.java:1138)
java.lang.Class.getResourceAsStream(Class.java:1998)
javax.mail.Session.loadProviders(Session.java:793)
javax.mail.Session.(Session.java:81)
javax.mail.Session.getInstance(Session.java:103)
website.Email.sendThanksToUser(Email.java:37)
blah
blah
blah

My site is designed using jsp
It uses a shared server instance (tomcat 5.0.27)
All other smtp configurations are fine, I 've tested them on my local server.
Some body Pls Help
 
Qaisar Iqbal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the code snippet:

Properties props = new Properties();
props.put("mail.smtp.host", "my.smtp.server");
// Session mailSession = Session.getInstance(props, null);

the remarked line of code throws an exception which is caught by which raises a JSPException, thrown to the browser.

Pls help ASAP
Thnx
 
Stephen Boston
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While I don't know very much on the javax.mail API, have you checked the properties or security settings on that folder location?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic