Re: JavaMail Props Not Being Set
Re: JavaMail Props Not Being Set
- Subject: Re: JavaMail Props Not Being Set
- From: Drew Thoeni <email@hidden>
- Date: Wed, 28 Jun 2006 22:55:21 -0400
So, I've tried the four suggestions:
Paul's "put in properties file": no effect.
Paul's "forgot to set properties": no effect
Mike's "wrong classpath": if I checked the right thing, that is
mail.jar and activation.jar in /Library/Java/Extensions: no effect
Henrique's "force setting of property setSMTPHost( System.getProperty
( "WOSMTPHost" ) );" no effect
Not quite true. Several had the effect of actually setting the props
(see below) but still sending mail fails with
"NoSuchProviderException". Any suggestions on more detailed debugging?
Props: {java.vendor=Apple Computer, Inc.,
WOWorkerThreadCountMax=256, <snip>
WOSMTPHost=smtp.comcast.net, <snip>
mail.smtp.host=smtp.comcast.net <snip>}
SendFailedException: javax.mail.NoSuchProviderException: smtp
regards,
Drew
On Jun 26, 2006, at 4:08 PM, Mike Schrag wrote:
You might want to check your classpath, too ... That it's saying
there's no SMTP provider sounds like you might have the javamail
API jar file in your classpath, but not the reference
implementation jar files that actually include the SMTP
implementation code?
ms
On Jun 26, 2006, at 3:39 PM, Paul Suh wrote:
On Jun 26, 2006, at 7:26 AM, Drew Thoeni wrote:
I am trying to set the SMTP host for JavaMail. I have attempted
set the properties in the Application, in the component, and in
Resources->Properties. None of these approaches seems to get the
props set (per exception at the end of this email).
In the Application() using this code:
public Application() {
super();
Properties props = System.getProperties();
//Specify the desired SMTP server
props.put( "WOSMTPHost", "smtp.comcast.net" );
props.put( "mail.smtp.host", "smtp.comcast.net" );
}
Drew,
You code only changes the values inside the "props" object that
you got back as a result of the System.getProperties() call. You
need to set them back into the system by using the
System.setProperties( Properties ) call, or two calls to
System.setProperty( String, String ).
Alternatively, you can specify the properties outside of the code
in two places. First, in the Properties file that is located
inside the .woa bundle at MyApp.woa/Contents/Resources/Properties,
you can put the lines:
WOSMTPHost=smtp.comcast.net
mail.smtp.host=smtp.comcast.net
just as written and they will set the WOSMTPHost and
mail.smtp.host properties for the application. Alternatively, you
can launch the application with the arguments:
-DWOSMTPHost=smtp.comcast.net -Dmail.smtp.host=smtp.comcast.net
in addition to any other launch arguments and the properties will
be set. Note that there is no space between the "-D" and the
property name, and that any characters that will cause problems
for the shell will need to be escaped or quoted.
In general, setting properties through code is discouraged -- much
better to do it from the Properties file for properties that don't
change frequently and from launch arguments for those that do
change frequently. BTW, property values specified on the command
line override those specified in the Properties file. See the WO
API docs on NSProperties for more details.
HTH
--Paul
Paul Suh
http://www.ps-enable.com/
email@hidden (240) 672-4212
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40pobox.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden