You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andreas Schildbach <an...@schildbach.de> on 2003/10/16 12:26:22 UTC
JavaMail Session JNDI Resource and Authentication
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@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: JavaMail Session JNDI Resource and Authentication
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Hi Andreas,
I'm planning on implementing this at some point soon too so I thought
I'd have a look to see what's up. I googled on javamail.providers and
your message here was one of the results that came up first!
Anyway, I couldn't find anything descriptive of your problem, but a
couple of ideas spring to mind: are you accessing the server via a proxy
server / firewall?
Also are you using send() or sendMessage()? Check this one:
http://java.sun.com/products/javamail/FAQ.html#connectsend
Another question to ask: are you using SSL to authenticate when you
shouldn't? Or vice-versa?
Adam
On 10/16/2003 12:26 PM Andreas Schildbach wrote:
> 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>
--
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org