Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail problem

 
P.Jamieson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I have some example JavaMail code. I have deployed it into my application. However, it complains about denied access to 1 line, system properties. Can you tell me how to overcome this problem and the best way to integrate this into my application (i.e. session bean).
Thanks!
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you reproduce the actual error message for us?
 
P.Jamieson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply...
Here is the exception:
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
This happens when I try to get system properties in order to connect to my mail server. I also tried some other code from Sun that uses JSP with the JavaMail. I tried it and I get the same error. I am sure that it is a security setting, but I am not sure how to do this in the descriptor.
 
P.Jamieson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to make a change in the security.policy file from a "read" permission to a "read,write" permission. That has solved the problem. However, is this the best way? Have I compromized my web security?
As follows...
// permissions for default domain
grant {
permission java.net.SocketPermission "*", "connect";
permission java.util.PropertyPermission "*", "read,write";
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In general, you should keep your security on as tight a leech as possible. I'd try to add another grant for the "read, write" PropertyPermission for a more specific code base instead of "everything".
 
P.Jamieson
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I'll give that a try...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic