geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kamalanathan Raman" <Kamalanathan_Ra...@infosys.com>
Subject RE: javax.mail.MessagingException: .. could not connect to SMTPhost-Reg
Date Thu, 22 Feb 2007 12:19:28 GMT
Hi Rick,

I forgot to mention one point in my previous mail , iam using the mail
resource that is available in the Geronimo and see my
geronimo-application.xml

<gbean name="mail/MailSession"
		class="org.apache.geronimo.mail.MailGBean">
		<attribute name="transportProtocol">smtp</attribute>
		<attribute name="useDefault">false</attribute>
		<attribute
name="host">BLRKECMSG13.ad.infosys.com</attribute>
		<attribute name="properties">
			mail.debug=true 
			mail.smtp.port=25
			mail.from=kamalanathan_raman@infosys.com
		</attribute>
	</gbean>


Kindly let me know whether this is correct or do I need to change
anything.


Thanks and Regards,
Kamal

-----Original Message-----
From: Rick McGuire [mailto:rickmcg@gmail.com] 
Sent: Thursday, February 22, 2007 5:16 PM
To: user@geronimo.apache.org
Subject: Re: javax.mail.MessagingException: .. could not connect to
SMTPhost-Reg

I already did.  It is picking up the "localhost" attribute because it's 
not properly using the "mail.smtp.host" property to configure the target

SMTP host.  Either of the two solutions I gave you below will fix the 
problem.

How are you creating the mail Session in your application?  Are you 
picking up the Geronimo mail resource, or are you configuring one 
yourself by calling Session.getInstance() or 
Session.getDefaultInstance()?  If you are using the Geronimo resource, 
then you need to specify a hostname on the MailGBean in your 
config.xml.  The following added in the same section as the 
SMTPTransport should do it:

        <gbean name="mail/MailSession">
            <attribute name="host">myhost</attribute>
        </gbean>

If you're not using the mail/MailResource provided by the server, then 
you need to make sure you set the property "mail.host" to your host in 
the property bundle you use when you call Session.getInstance(). 

Rick


Kamalanathan Raman wrote:
> Hi Rick,
>
>    Thanks for replying, iam not sure from where it is picking the
> "localhost" attribute . I have mentioned my mail server host which is
> different everywhere in my application and also i have changed in the
> "config.xml" file inside Geronimo/var folder also to reflect to my
host
> , but iam not sure from where it is picking up this attribute. Kindly
> help me resolve this issue.
>
> Thanks and Regards,
> Kamal
>
> -----Original Message-----
> From: Rick McGuire [mailto:rickmcg@gmail.com] 
> Sent: Thursday, February 22, 2007 3:50 PM
> To: user@geronimo.apache.org
> Subject: Re: javax.mail.MessagingException: .. could not connect to
> SMTPhost -Reg
>
> There's a bug in the code that sorts out the connection host when you 
> are using Transport.send(). There are two workarounds I know of for
the 
> problem:
>
> 1) set the target SMTP host using the "mail.host" property rather than

> "mail.smtp.host", or
> 2) Rather than use Transport.send(), explicitly request a transport 
> instance from the Session and call connect() yourself, passing in the 
> appropriate target and port.
>
> It also appears from the Exception getting thrown and the stack trace,

> that your application is picking up the Sun mail.jar, resulting in 
> mixing of the Geronimo mail api code with the Sun SMTPTransport 
> implemenation. This should, in theory, work, but is not a
configuration 
> we've doing any testing with at all. You should remove any dependency 
> you have on the sun mail.jar and make sure you're picking up the 
> geronimo-javamail-transport jar included with 1.1.1.
>
> Rick
>
> Kamalanathan Raman wrote:
>   
>> Hi ,
>>
>> Iam trying to send a notification mail using the java mail in
Geronimo
>>     
>
>   
>> 1.1.1 . When I try to send the mail iam getting this following 
>> exception , can any one give a pointer regarding where iam going
wrong
>>     
>
>   
>> and what to do...
>>
>> _javax.mail.SendFailedException_: Send failure 
>> (_javax.mail.MessagingException_: Could not connect to SMTP host: 
>> localhost, port: 25 (_java.net.ConnectException_: Connection refused:

>> connect))
>>
>> at javax.mail.Transport.send(_Transport.java:161_)
>>
>> at javax.mail.Transport.send(_Transport.java:46_)
>>
>> at
>>     
> com.symcor.common.util.SendMail.sendNotification(_SendMail.java:171_)
>   
>> at
>>     
> com.symcor.common.util.SendMail.sendNotification(_SendMail.java:92_)
>   
>> at
com.symcor.eds.app.RunEDSService.sendMail(_RunEDSService.java:411_)
>>
>> at com.symcor.eds.app.RunEDSService.main(_RunEDSService.java:338_)
>>
>> Caused by: _javax.mail.MessagingException_: Could not connect to SMTP

>> host: localhost, port: 25 (_java.net.ConnectException_: Connection 
>> refused: connect)
>>
>> at
>>     
> com.sun.mail.smtp.SMTPTransport.openServer(_SMTPTransport.java:867_)
>   
>> at 
>>
>>     
>
com.sun.mail.smtp.SMTPTransport.protocolConnect(_SMTPTransport.java:156_
> )
>   
>> at javax.mail.Service.connect(_Service.java:215_)
>>
>> at javax.mail.Service.connect(_Service.java:83_)
>>
>> at javax.mail.Service.connect(_Service.java:68_)
>>
>> at com.sun.mail.smtp.SMTPTransport.connect(_SMTPTransport.java:93_)
>>
>> at javax.mail.Transport.send(_Transport.java:92_)
>>
>> ... 5 more
>>
>> Caused by: _java.net.ConnectException_: Connection refused: connect
>>
>> at java.net.PlainSocketImpl.socketConnect(_Native Method_)
>>
>> at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>
>> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>
>> at java.net.PlainSocketImpl.connect(Unknown Source)
>>
>> at java.net.SocksSocketImpl.connect(Unknown Source)
>>
>> at java.net.Socket.connect(Unknown Source)
>>
>> at java.net.Socket.connect(Unknown Source)
>>
>> at java.net.Socket.<init>(Unknown Source)
>>
>> at java.net.Socket.<init>(Unknown Source)
>>
>> at
>>     
> com.sun.mail.util.SocketFetcher.getSocket0(_SocketFetcher.java:131_)
>   
>> at
com.sun.mail.util.SocketFetcher.getSocket(_SocketFetcher.java:113_)
>>
>> at
>>     
> com.sun.mail.smtp.SMTPTransport.openServer(_SMTPTransport.java:836_)
>   
>> ... 11 more
>>
>> 2007-02-22 14:50:47,674 INFO com.symcor.common.util.SendMail 
>> -sendNotification(...):exit
>>
>> 2007-02-22 14:50:47,674 ERROR root -main[]:Send failure 
>> (_javax.mail.MessagingException_: Could not connect to SMTP host: 
>> localhost, port: 25 (_java.net.ConnectException_: Connection refused:

>> connect))
>>
>> _javax.mail.SendFailedException_: Send failure 
>> (_javax.mail.MessagingException_: Could not connect to SMTP host: 
>> localhost, port: 25 (_java.net.ConnectException_: Connection refused:

>> connect))
>>
>> at javax.mail.Transport.send(_Transport.java:161_)
>>
>> at javax.mail.Transport.send(_Transport.java:46_)
>>
>> at
>>     
> com.symcor.common.util.SendMail.sendNotification(_SendMail.java:171_)
>   
>> at
>>     
> com.symcor.common.util.SendMail.sendNotification(_SendMail.java:92_)
>   
>> at
com.symcor.eds.app.RunEDSService.sendMail(_RunEDSService.java:411_)
>>
>> at com.symcor.eds.app.RunEDSService.main(_RunEDSService.java:338_)
>>
>> Caused by: _javax.mail.MessagingException_: Could not connect to SMTP

>> host: localhost, port: 25 (_java.net.ConnectException_: Connection 
>> refused: connect)
>>
>> at
>>     
> com.sun.mail.smtp.SMTPTransport.openServer(_SMTPTransport.java:867_)
>   
>> at 
>>
>>     
>
com.sun.mail.smtp.SMTPTransport.protocolConnect(_SMTPTransport.java:156_
> )
>   
>> at javax.mail.Service.connect(_Service.java:215_)
>>
>> at javax.mail.Service.connect(_Service.java:83_)
>>
>> at javax.mail.Service.connect(_Service.java:68_)
>>
>> at com.sun.mail.smtp.SMTPTransport.connect(_SMTPTransport.java:93_)
>>
>> at javax.mail.Transport.send(_Transport.java:92_)
>>
>> ... 5 more
>>
>> Caused by: _java.net.ConnectException_: Connection refused: connect
>>
>> at java.net.PlainSocketImpl.socketConnect(_Native Method_)
>>
>> at java.net.PlainSocketImpl.doConnect(Unknown Source)
>>
>> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
>>
>> at java.net.PlainSocketImpl.connect(Unknown Source)
>>
>> at java.net.SocksSocketImpl.connect(Unknown Source)
>>
>> at java.net.Socket.connect(Unknown Source)
>>
>> at java.net.Socket.connect(Unknown Source)
>>
>> at java.net.Socket.<init>(Unknown Source)
>>
>> at java.net.Socket.<init>(Unknown Source)
>>
>> at
>>     
> com.sun.mail.util.SocketFetcher.getSocket0(_SocketFetcher.java:131_)
>   
>> at
com.sun.mail.util.SocketFetcher.getSocket(_SocketFetcher.java:113_)
>>
>> at
>>     
> com.sun.mail.smtp.SMTPTransport.openServer(_SMTPTransport.java:836_)
>   
>> ... 11 more
>>
>> Thanks and Regards,
>>
>> Kamal
>>
>> **************** CAUTION - Disclaimer *****************
>> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended

>> solely for the use of the addressee(s). If you are not the intended 
>> recipient, please notify the sender by e-mail and delete the original

>> message. Further, you are not to copy, disclose, or distribute this 
>> e-mail or its contents to any other person and any such actions are 
>> unlawful. This e-mail may contain viruses. Infosys has taken every 
>> reasonable precaution to minimize this risk, but is not liable for
any
>>     
>
>   
>> damage you may sustain as a result of any virus in this e-mail. You 
>> should carry out your own virus checks before opening the e-mail or 
>> attachment. Infosys reserves the right to monitor and review the 
>> content of all messages sent to or from this e-mail address. Messages

>> sent to or from this e-mail address may be stored on the Infosys 
>> e-mail system.
>> ***INFOSYS******** End of Disclaimer ********INFOSYS***
>>
>>     
>
>
>   


Mime
View raw message