title: HTTP Status 500 - java.net.ConnectException: Connection refused: connect
body: <p>I tried to start application on remote host and received the below exception</p>
  
  <pre><code>message java.net.ConnectException: Connection refused: connect
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception 
  javax.servlet.ServletException: java.net.ConnectException: Connection refused: connect
      com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:1010)
      com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  
  root cause 
  java.net.ConnectException: Connection refused: connect
      java.net.DualStackPlainSocketImpl.connect0(Native Method)
      java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
      java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
      java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      java.net.Socket.connect(Socket.java:579)
      java.net.Socket.connect(Socket.java:528)
      sun.net.NetworkClient.doConnect(NetworkClient.java:180)
      sun.net.www.http.HttpClient.openServer(HttpClient.java:378)
      sun.net.www.http.HttpClient.openServer(HttpClient.java:473)
      sun.net.www.http.HttpClient.&lt;init&gt;(HttpClient.java:203)
      sun.net.www.http.HttpClient.New(HttpClient.java:290)
      sun.net.www.http.HttpClient.New(HttpClient.java:306)
      sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:995)
      sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:931)
      sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:849)
      sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1299)
      com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:633)
      com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:189)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:799)
      com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
      com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
      com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1210)
      com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:568)
      com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:302)
      scala.xml.factory.XMLLoader$class.loadXML(XMLLoader.scala:40)
      scala.xml.XML$.loadXML(XML.scala:40)
      scala.xml.factory.XMLLoader$class.load(XMLLoader.scala:54)
      scala.xml.XML$.load(XML.scala:40)
      com.exo.AppUser.&lt;init&gt;(AppUser.scala:17)
      com.exo.OdaWebApplication.&lt;init&gt;(OdaWebApplication.scala:24)
      sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      java.lang.Class.newInstance(Class.java:374)
      com.vaadin.terminal.gwt.server.ApplicationServlet.getNewApplication(ApplicationServlet.java:82)
      com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:984)
      com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:807)
      com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  </code></pre>
  
  <p>i tried figuring out the reason and checked some issues but it's still not working
  i found some <a href="http://javarevisited.blogspot.ru/2013/02/java-net-ConnectException-Connection-refused.html" rel="nofollow">information</a> about it, but it was helpless
  i checked some issues like:</p>
  
  <ol>
  <li>service not listening - catalina logged about listening </li>
  <li>firewall bocked request - no firewall, no antivirus</li>
  <li>user can't connect to server - it's running only in localhost</li>
  <li>application don't work - correctly work from IDE</li>
  </ol>
  
  <p>Application run correctly from IDE, and also before host restart.</p>
  
  <p>I can't understand why this is happening.</p>