• Post Reply Bookmark Topic Watch Topic
  • New Topic

Session bean for sending e-mail

 
Erwin DES
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I use a method in my session bean that contains following code-fragment :

The problem is that I get an error in Runtime :
" java.rmi.RemoteException: nested exception is: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write); nested exception is:
java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)...."

How exactly can I solve this problem?
Thanks for any help.
EDS
erwin.des@skynet.be
[ February 26, 2003: Message edited by: Erwin De Stercke ]
[ February 26, 2003: Message edited by: Erwin De Stercke ]
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Java Network Programming by E R Harold published by Orielly he does -
props = new props();
props.put ( "mail.host", "mail.cloud9.net" );
I see you have a different key. Where did you get it?
Over here they talk about a mail.debug property. Have your tried that?
 
Erwin DES
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response.
The example I use is partly taken from the book "Teach yourself J2ee in 21 days" from SAMS.
The program works fine if used outside an EJB (thus a simple main class for example).
Thanks to your reference to Sun FAQ, I think the problem has to do with granting access to the Property (because I use System.getProperties();.
I followed the instruction in the FAQ by inserting a grant clause to the security policy file... but is still doesn't work.
I also inserted session.setDebug(true) to my code to obtain more error-results...but I still don't get more information. I think the errorlist I get is all there is.
Hereby the complete list.


What other solution can I use?
Thanks for any help!
erwin.des@skynet.be
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Over here they do it from in a bean the difference being they get their session from the JNDI context.
Whose EJB container are you using?
 
Erwin DES
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have already tried out the example from Sun. But the problem is that I use Sun One EE (free download / 60 days trial) and that the example uses the deploytool.
The question remains then how to define my mail-session in the JNDI?
Sun One uses the J2ee RI.
 
Dana Hanna
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why use System.getProperties()?
These would be defining properties for the entire JVM, which is why your ejb container is complaining. You aren't playing nice with other EJBs!
Use:
Properties props = new Properties();
 
Erwin DES
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks,
My code is working now.
But, I'm still interested in how to make a better solution in working it out with JNDI.
The problem is that I don't find the right settings for Sun One EE.
Any suggestions?
Thanks,
EDS
 
Dana Hanna
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What setting are you looking for?
 
Erwin DES
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need access to the JNDI-Tree and I need to define my mail-session in the JNDI. This way I don't have to hard-code my servername and e-mailaddress ...
Problem is I don't now how with Sun One EE.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!