• Post Reply Bookmark Topic Watch Topic
  • New Topic

why java mail application not portable for both standalone and web

 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

i developed a small java application for sending mails to list of email id's.

if configured the properties by giving property
1.mail.host=(mailserver address)
2.mail.debug=true

in stanalone application,it work fine and the mails were send to the list of mails id by giving the message in debug mode.

Connected to host: 10.45.26.62, port: 25;

but, when i integrated the same application in web container (tomcat and sun application server) its giving the following error.

javax.mail.MessagingException: Could not connect to SMTP host: 10.45.26.62, port: 25;
nested exception is:
java.net.SocketException: Software caused connection abort: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1213)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:311)
at javax.mail.Service.connect(Service.java:233)
at javax.mail.Service.connect(Service.java:134)
 
Paul Clapham
Sheriff
Posts: 21878
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the software on your web application server couldn't connect to the SMTP server, just as the message says. It isn't a given that any computer in the world can automatically connect to any other computer in the world, instead we have networks and firewalls and proxies and virus scanners that control who can connect to what.

So first check out your basic network connection. Go to a command line (on the same machine as the app server!) and type

PING 10.45.26.62

This tells you if your machine can physically connect to the machine where the SMTP server is running. Next type

TELNET 10.45.26.62 25

This tells you if your machine can connect to the SMTP server itself. If either of them fail (as I guess they will), talk to your network administrator to find out why.
 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi paul,

but, how come it is ruuning sucessfully on standalone application.
bcoz both stanalone application and web application are running on same JVM(localhost).

i tried to the two options u mentioned.

ping 10.45.26.62
it pinged sucessfully

telnet 10.45.26.62
Connecting To 10.45.26.62...Could not open connection to the host, on port 23: Connect failed

thanks in advance
ravi
[ November 16, 2005: Message edited by: ravi v kumar ]
 
Paul Clapham
Sheriff
Posts: 21878
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
telnet 10.45.26.62
No,

TELNET 10.45.26.62 25
 
ravi v kumar
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi paul,

when i executed the telnet command in am getting the following message.

C:\>telnet 10.45.26.62 25

Connecting To 10.45.26.62...Could not open connection to the host, on port 25: Connect failed

rgds,
ravi
 
Paul Clapham
Sheriff
Posts: 21878
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So that could mean there is no SMTP server running on 10.45.26.62. Or (unlikely) that the SMTP server there is listening on some other port. Or that some router or firewall or virus-checker is preventing access to that port. The people who configured the network should be able to explain to you what is going on.
 
Seetesh Hindlekar
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your mail server is having a firewall then the port 25 is normally blocked as part of the blocking rules.

You have to tell the administrator to release the port 25 ie uncheck the checkbox for the port 25.

Start - Programs - Network Associates - VirusScan Console - Access Protection to uncheck the port 25.

Rgds,

Seetesh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!