0

I have deployed My Java server to Jelactic PaaS platform. The project is working fine on the localhost but there it gives com.sun.mail.util.MailConnectException .... Any Solutions Please.... Thanks in Advance..

The stack trace of exception is:

com.sun.mail.util.MailConnectException: Couldn't connect to host, port: newmailhost.cc.iitk.ac.in, 993; timeout -1; nested exception is: java.net.UnknownHostException: newmailhost.cc.iitk.ac.in com.sun.mail.util.MailConnectException: Couldn't connect to host, port: newmailhost.cc.iitk.ac.in, 993; timeout -1; nested exception is: java.net.UnknownHostException: newmailhost.cc.iitk.ac.in at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:693) at javax.mail.Service.connect(Service.java:345) at javax.mail.Service.connect(Service.java:226) at Android.MainThread.uidChange(MainThread.java:69) at Android.MainThread.execute(MainThread.java:41) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) Caused by: java.net.UnknownHostException: newmailhost.cc.iitk.ac.in at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at java.net.Socket.connect(Socket.java:528) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:301) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:229) at com.sun.mail.iap.Protocol.(Protocol.java:116) at com.sun.mail.imap.protocol.IMAPProtocol.(IMAPProtocol.java:121) at com.sun.mail.imap.IMAPStore.newIMAPProtocol(IMAPStore.java:710) at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:659) ... 29 more

Wamiq
  • 1,114
  • 3
  • 12
  • 23
  • Have you determined that IMAP ports aren't blocked or otherwise firewalled? Many web hosts do this by default. – Max Apr 21 '14 at 04:42
  • No, Ive talked to Jelastic help team they said the host is not reachabe, there is no fierwall problem. But the Server works on localhost! – Wamiq Apr 21 '14 at 19:55

1 Answers1

0

Problem is your mail server doesn't have proper DNS records published. You can check for yourself here: http://dnsquery.org/dnsquery/newmailhost.cc.iitk.ac.in/ANY

Check your hosts file on your local computer - maybe it has an entry for newmailhost.cc.iitk.ac.in, or else you're using a slightly different hostname to this one on your local computer?

Since this is an ac.in address, another possibility is this is resolved within your university network, but it's not available externally.

If you replace the hostname with its corresponding IP address (e.g. check it from your computer) you can eliminate DNS from the situation - but if the server is not accessible across the Internet it still won't work.

Damien - Layershift
  • 1,508
  • 8
  • 15