Jack,
I have plans for JavaMail and Tomcat. As of this moment on our
production servers we are using JRun. At the moment we are working on a
application that will use Javamail. When we get to that point I will
let you know what we find out. The ETA is July 25 for completion, so I
should have a solution between now & then. As of the moment we are
still working on some other aspects so I currently do not have the time
to take care of this now.
Otherwise if you come accross a solution in the mean time let me know,
otherwise I will let you know.
[EMAIL PROTECTED] wrote:
> Hi Tim,
>
> I've created the /usr/java/jakarta-tomcat/conf/tomcat.policy.custom file
> with the permissions you suggested. I even gave AllPermission.
>
> I checked the tomcat.policy file after I restarted the server and verified
> that the new permission is there.
>
> I still get the java.security.AccessControlException:access denied
> (java.net.SocketPermission stage.icarian.com resolve) error.
>
> Has anyone on this list gotten the JavaMail to work with servlets??
>
> Thanks for any help.
> Jack
>
>
>
>
>
>
> Hi Jack,
>
> You'll need to give more permission to the servlet. Create a file called:
>
> /usr/java/jakarta-tomcat/conf/tomcat.policy.custom
>
> Put in the following line:
>
> permission
> java.net.SocketPermission"localhost:1024-","connect,accept,listen,resolve";
>
> This should do the trick. If not, and you're sure you trust all the
> servlets running on your machine, you can give the servlet full permissions
> by adding:
>
> permission java.security.AllPermission;
>
> to tomcat.policy.custom.
>
> _Tim
>
> On 7/16/01 10:48 AM, " [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> "
> < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote:
>
>
>> Hi,
>>
>> I have a java servlet sending a email via smtp using JavaMail. The servlet
>> sends out the email fine when executed through telnet session. When I run
>> the servlet thru Tomcat, I get a java.security.AccessControlException:
>> access denied (java.net.SocketPermission stage.icarian.com resolve) error.
>>
>> I'm assuming it's a security manager problem. I may be wrong. I need to
>
> know
>
>> how to configure the tomcat.policy.custom file to fix this problem.
>>
>> The servlet code:
>> import java.util.*;
>> import java.io.*;
>> import javax.mail.*;
>> import javax.mail.internet.*;
>> import javax.activation.*;
>>
>> public class Mailer {
>>
>> private String host = "stage.icarian.com";
>> private String to;
>> private String from;
>> private String subject;
>>
>> public Mailer(String to, String from, String subject) {
>> this.to = to;
>> this.from = from;
>> this.subject = subject;
>> }
>>
>> public void send() {
>> Properties props = new Properties();
>> props.setProperty("mail.smtp.host",host);
>> Session s = Session.getInstance(props,null);
>> try {
>> MimeMessage msg = new MimeMessage(s);
>> msg.setFrom(new InternetAddress(from));
>> msg.addRecipient(msg.RecipientType.TO, new InternetAddress(to));
>> msg.setSubject(subject);
>> msg.setText("");
>> Transport transport = s.getTransport("smtp");
>> transport.connect();
>> transport.send(msg);
>>
>>
>> // Transport.send(msg);
>> } catch (MessagingException mex) {
>> mex.printStackTrace();
>> }
>> }
>>
>>
>> My tomcat.policy file
>> grant codeBase "file:/home/sites/site4/web/-" {
>> permission java.net.SocketPermission "localhost:1024-", "listen,connect";
>> permission java.util.PropertyPermission "*", "read,write";
>> permission java.lang.RuntimePermission "accessClassInPackage.sun.io";
>> permission java.io.FilePermission "-", "read,write,delete";
>> };
>>
>> Thanks for any help.
>> Jack
>>
>>
>>
>> _______________________________________________
>> cobalt-developers mailing list
>> [EMAIL PROTECTED]
>
> <mailto:[EMAIL PROTECTED]>
>
>> http://list.cobalt.com/mailman/listinfo/cobalt-developers
>
> <http://list.cobalt.com/mailman/listinfo/cobalt-developers>
>
>
>
> _______________________________________________
> cobalt-developers mailing list
> [EMAIL PROTECTED]
> http://list.cobalt.com/mailman/listinfo/cobalt-developers
--
Sincerely,
William L. Thomson Jr.
Support Group
Obsidian-Studios Inc.
439 Amber Way
Petaluma, Ca. 94952
Phone/fax 707.766.9509
http://www.obsidian-studios.com
_______________________________________________
cobalt-developers mailing list
[EMAIL PROTECTED]
http://list.cobalt.com/mailman/listinfo/cobalt-developers