f



JAVAMAIL SMTP error 421

Hi all,


I've been looking at this problem for a while, browsing all possible
resources for a possible explanation but no way.
My problem is the following : 

I've got a JAVA application listening to messages falling on a
MQSeries queue. The message falling on the queue contains all required
information to compose a mail intended for some recipients. The
application is connected to a mail server and is supposed to send the
mail.
In our development environment everything is fine and works properly.
We are using Exchange server. I made several tests with some 3000
messages falling on the queue and we got 3000 mails in our mail boxes.
The program has been installed at a client site and there we run into
trouble.
After the fifth message has been sent, the program ends with an
exception. It looks like the SMTP server had closed the connection
with no apparent reason.

The log looks like this : 

Wed Jun 23 14:59:49 CEST 2004 - spy3 - 5 tasks done.
Wed Jun 23 14:59:50 CEST 2004 - alerter - MailError - Mail server
error in execu
ting a process.
Error when sending a mail through Java Mail API.Can't send command to
SMTP host;
 nested exception is:
     java.net.SocketException: Software caused connection abort:
socket write error
null
com.misys.alerter.Spy$MailError: Error when sending a mail through
Java Mail API
..Can't send command to SMTP host;
  nested exception is:
        java.net.SocketException: Software caused connection abort:
socket write
 error
        at com.misys.alerter.SpyMasterQ.doAction(SpyMasterQ.java:497)
        at com.misys.alerter.Spy.run(Spy.java:112)

The line 497 is : try {mailer.sendMail(tmptitle, tmpbody,
recipientTo,recipientDummy, recipientDummy);

The class mailer fills in a mimeMessage and calls 

		transport.sendMessage(message, message.getAllRecipients() ) ;

which is where I loose control.


The connection to the mail server is made through this method : 

public boolean connectSrv( String host, String user, String password) 
				throws NoSuchProviderException, MessagingException {

		Properties props = new Properties();
		props.put("mail.smtp.connectiontimeout", "0" );
		props.put("mail.smtp.timeout", "0" );
		props.put("mail.debug", "true");
		session = Session.getDefaultInstance(props, null);
		transport = session.getTransport("smtp");
		transport.connect(host, user, password);
		/* store date time when connection occurs */
		dtconnected = new GregorianCalendar();

		return transport.isConnected();		
	}


I added the debug property to get more information. It shows an SMTP
error 421.

Here are some bits of output : 

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 250 2.0.0 OK

DEBUG SMTP SENT: NOOP
DEBUG SMTP RCVD: 421 Too many errors on this connection---closing

DEBUG SMTP SENT: NOOP


I have the feeling that something goes wrong on the server side but
have no idea what.
Has any of you already experienced such problem ? 

Thanks for your time reading this. Any help or suggestion will be
highly appreciated.

JC
0
depiessj (2)
7/9/2004 8:31:48 AM
comp.lang.java.programmer 52714 articles. 1 followers. Post Follow

3 Replies
901 Views

Similar Articles

[PageSpeed] 52

Hi,
Blacksheep wrote:
[...] 
> I added the debug property to get more information. It shows an SMTP
> error 421.
> 
> Here are some bits of output :
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 250 2.0.0 OK
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 250 2.0.0 OK
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 421 Too many errors on this connection---closing
> 
> DEBUG SMTP SENT: NOOP
> 
> 
> I have the feeling that something goes wrong on the server side but
> have no idea what.

I found the following via google.

http://www.developersdex.com/asp/message.asp?p=2676&ID=%3C%23y9WpegWEHA.716%40TK2MSFTNGP11.phx.gbl%3E

And to tell the truth, if I find out how to bring my MTAs to close
connections that send repeated NOOPS, I will configure them
appropriatly ;-).

It's most likely an error on the server side, maybe indeed there's a counter
not reset as mentioned in the thread I linked to.

1. Get in touch with the MTA-admin, if it's someone on-site, else
find out what MTA is running on the other side (see it's response to the
EHLO or HELO command at the start of your debug-transscript), and try to
get in contact with the maintainers other users of the product (via
mailinglists etc.).

hth,
Tom Regner
-- 
Dievision GmbH | Kriegerstrasse 44 | 30161 Hannover
Telefon: (0511) 288791-0 | Telefax: (0511) 288791-99
http://www.dievision.de | mailto:regner@dievision.de
0
regner (6)
7/9/2004 11:31:55 AM
java is a pain
depiessj@misys.com (Blacksheep) wrote in message news:<ead94383.0407090031.6621ed0f@posting.google.com>...
> Hi all,
> 
> 
> I've been looking at this problem for a while, browsing all possible
> resources for a possible explanation but no way.
> My problem is the following : 
> 
> I've got a JAVA application listening to messages falling on a
> MQSeries queue. The message falling on the queue contains all required
> information to compose a mail intended for some recipients. The
> application is connected to a mail server and is supposed to send the
> mail.
> In our development environment everything is fine and works properly.
> We are using Exchange server. I made several tests with some 3000
> messages falling on the queue and we got 3000 mails in our mail boxes.
> The program has been installed at a client site and there we run into
> trouble.
> After the fifth message has been sent, the program ends with an
> exception. It looks like the SMTP server had closed the connection
> with no apparent reason.
> 
> The log looks like this : 
> 
> Wed Jun 23 14:59:49 CEST 2004 - spy3 - 5 tasks done.
> Wed Jun 23 14:59:50 CEST 2004 - alerter - MailError - Mail server
> error in execu
> ting a process.
> Error when sending a mail through Java Mail API.Can't send command to
> SMTP host;
>  nested exception is:
>      java.net.SocketException: Software caused connection abort:
> socket write error
> null
> com.misys.alerter.Spy$MailError: Error when sending a mail through
> Java Mail API
> .Can't send command to SMTP host;
>   nested exception is:
>         java.net.SocketException: Software caused connection abort:
> socket write
>  error
>         at com.misys.alerter.SpyMasterQ.doAction(SpyMasterQ.java:497)
>         at com.misys.alerter.Spy.run(Spy.java:112)
> 
> The line 497 is : try {mailer.sendMail(tmptitle, tmpbody,
> recipientTo,recipientDummy, recipientDummy);
> 
> The class mailer fills in a mimeMessage and calls 
> 
> 		transport.sendMessage(message, message.getAllRecipients() ) ;
> 
> which is where I loose control.
> 
> 
> The connection to the mail server is made through this method : 
> 
> public boolean connectSrv( String host, String user, String password) 
> 				throws NoSuchProviderException, MessagingException {
> 
> 		Properties props = new Properties();
> 		props.put("mail.smtp.connectiontimeout", "0" );
> 		props.put("mail.smtp.timeout", "0" );
> 		props.put("mail.debug", "true");
> 		session = Session.getDefaultInstance(props, null);
> 		transport = session.getTransport("smtp");
> 		transport.connect(host, user, password);
> 		/* store date time when connection occurs */
> 		dtconnected = new GregorianCalendar();
> 
> 		return transport.isConnected();		
> 	}
> 
> 
> I added the debug property to get more information. It shows an SMTP
> error 421.
> 
> Here are some bits of output : 
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 250 2.0.0 OK
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 250 2.0.0 OK
> 
> DEBUG SMTP SENT: NOOP
> DEBUG SMTP RCVD: 421 Too many errors on this connection---closing
> 
> DEBUG SMTP SENT: NOOP
> 
> 
> I have the feeling that something goes wrong on the server side but
> have no idea what.
> Has any of you already experienced such problem ? 
> 
> Thanks for your time reading this. Any help or suggestion will be
> highly appreciated.
> 
> JC
0
mpetre (2)
7/31/2004 12:51:46 AM
depiessj@misys.com (Blacksheep) wrote in 
news:ead94383.0407090031.6621ed0f@posting.google.com:

> 
> I have the feeling that something goes wrong on the server side but
> have no idea what.
> Has any of you already experienced such problem ? 

Wild guess, but check for anti spam/DDOS measures on your customer's 
server. If you are trying to rapid fire a lot of transactions through 
the same connection, it could be shutting you out.

Gary
0
8/1/2004 6:25:42 PM
Reply: