Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

JavaMail Session JNDI Resource and Authentication

Andreas Schildbach

2003-10-16

Replies:

Hello everyone,

I am trying to set up a JavaMail Session JNDI Resource to an SMTP server
that requires authentication. In the JavaMail documentation I could not
find how to supply a password in the Session Properties. However, I
found a few Google references to "mail.smtp.password" and
"mail.password". I tried both, but each time I get an
javax.mail.AuthenticationFailedException.

I am using Tomcat 4.1.27 and JavaMail 1.3.1 (JAF 1.02). OS: Windows XP

Can anyone help me find my error, please?

Here is the debug output from JavaMail:

DEBUG: JavaMail version 1.3.1
DEBUG: java.io.FileNotFoundException:
C:\j2sdk1.4.2\jre\lib\javamail.providers (The system cannot fi
nd the file specified)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name:
{com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPOR
T,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc],
com.sun.mail.imap.IMAPStore=javax.mai
l.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems,
Inc], com.sun.mail.pop3.POP3Stor
e=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
Microsystems, Inc]}
DEBUG: Providers Listed By Protocol:
{imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStor
e,Sun Microsystems, Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Micros
ystems, Inc],
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsyste
ms, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException:
C:\j2sdk1.4.2\jre\lib\javamail.address.map (The system cannot
find the file specified)
DEBUG: getProvider() returning
javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Su
n Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true

And here is the resource definition in my server.xml:

<Resource name="mail/Session" auth="Container" type="javax.mail.Session"/>
<ResourceParams name="mail/Session">

<parameter><name>mail.debug</name><value>true</value></parameter>
<parameter><name>mail.transport.protocol</name><value>smtp</value></parameter>
<parameter><name>mail.smtp.host</name><value>myserver</value></parameter>
<parameter><name>mail.smtp.port</name><value>25</value></parameter>
<parameter><name>mail.smtp.auth</name><value>true</value></parameter>
<parameter><name>mail.smtp.user</name><value>myusername</value></parameter>
<parameter><name>mail.smtp.password</name><value>mypassword</value></parameter>

</ResourceParams>

Regards,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.