commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavan Kumar <pavan.technol...@gmail.com>
Subject Problem while sending mail using commons email
Date Wed, 06 May 2009 08:39:37 GMT
Hi,

I wrote a custom binding component to send email notifications which used
commons email. The problem is that the code in the component tries to
connect to the "localhost" even though the mail server IP is given and
finally end in a SocketException. The same exact piece of code with out any
changes works if I run it as a standalone java program.

I did some googling and tried options like using the hostname instead of
IPaddress etc, but no use. The connectivity between the system I run this
app and the mail server is also good.

I have set the debug on for the commons-email classes and the trace is as
below

I use the following software
    apache-servicemix-3.0-incubating
    commons-email-1.1

*Standalone java program
----------------------------------------*
DEBUG: JavaMail version 1.3.1
DEBUG: java.io.FileNotFoundException:
D:\Installations\JavaIDEs\MyEclipse\MyEclipse_5.5.1_GA\jre\lib\javamail.providers
(The system cannot find 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[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, Inc],
com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun
Microsystems, Inc],
com.sun.mail.pop3.POP3Store=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.IMAPStore,Sun
Microsystems, Inc],
pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun
Microsystems, Inc],
smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun
Microsystems, 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:
D:\Installations\JavaIDEs\MyEclipse\MyEclipse_5.5.1_GA\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,Sun
Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host *"10.193.50.60", port 25*  <<
Connected correctly and mail is sent nicely

220 bgxius-ex01.XIUS-bcgi.ltd Microsoft ESMTP MAIL Service ready at Wed, 6
May 2009 12:50:09 +0530
DEBUG SMTP: connected to host "10.193.50.60", port: 25

*Same code from within the binding component
*
-----------------------------------------------------------------------------
Loading javamail.default.providers from
jar:file:/D:/Installations/J2EE/Servers/ServiceMix/apache-servicemix-3.0-incubating/bin/../lib/optional/mail.jar!/META-INF/javamail.default.providers
DEBUG: loading new provider protocol=imap,
className=com.sun.mail.imap.IMAPStore, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=smtp,
className=com.sun.mail.smtp.SMTPTransport, vendor=Sun Microsystems, Inc,
version=null
DEBUG: loading new provider protocol=pop3,
className=com.sun.mail.pop3.POP3Store, vendor=Sun Microsystems, Inc,
version=null
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG: getProvider() returning provider protocol=smtp;
type=javax.mail.Provider$Type@12be8e1;
class=com.sun.mail.smtp.SMTPTransport; vendor=Sun Microsystems, Inc
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host *"localhost", port 25*  << tries to
connect localhost & results in exception

DEBUG SMTP: exception reading response:* java.net.SocketException:
Connection reset*
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "localhost", port 25

DEBUG SMTP: exception reading response: java.net.SocketException: Connection
reset
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "localhost", port 25


Any help would be appreciated.


Thanks & Reagrds
Pavan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message