⬆️ ⬇️

Eclipse on Java or read stackracks more attentively

I do web development, at work we use the stack of technologies on scala for our projects, the basis of this stack is the Lift framework , also known as liftweb . Lift uses sbt to manage the build and jetty or another servlet container as a web server.



Once I had to work from home, it worked perfectly, the development version of the server started up, everything was as usual. But the next day, when I returned to work at the office, when I first started the server, there was a complete bummer. A java.net.ConnectException with the text Connection timed out: connect and a trace of 86 lines spread out wide on the console screen right at the start. Unfortunately, it was not written where exactly it could not establish a connection. Since the server is only starting up, the only connection that it should attempt to establish is LISTEN on a specific port. But the exception is clearly not about that. Moreover, the port has already responded with some kind of error more than 500 .



From the right googled just that .

')

I decided to clean the caches and try again. Again the same exception. Well, we should try to clean the ivy caches, maybe some broken library was busy. Did not help. Maybe something with the disk? Disk check showed no errors (SSD disk). How is it that yesterday everything worked at home ?! And the day before yesterday, and here at work, everything worked. Maybe the system is not updated, and there is already a fix? No new updates. Maybe antivirus or firewall? Disconnected, did not help. It was thought that perhaps the system considered my version of java completely unsafe and blocked its network. I rearranged the JDK , deleting all the old versions, just in case, once again I cleaned all the caches and did a disk cleanup using the system tools. Did not help.



Strangely, the DNS servers and houses and Google are registered here, in theory should work the same way.



I began to search for what the address could be, I found only the schema definition in the web.xml in the WEB-INF folder in the root of the web server's public directory. Googled replacement for the DTD file web-app_2_3.dtd and didn’t really find anything. And in truth, I could not believe that this url should be twitching at all.



Here is the schema definition:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">



Another thought that had to be checked - if you take a laptop on which it works, bring it to work and try to start it in a working network - it will work or not. Checked Does not work. Same exception.



This is already interesting. So the local network is to blame, but where exactly we can’t go is unclear. I tried to start the project from machines of other developers - the same error.



Here at the colleague the sensible thought flashed - and what if to start in general without network. Checked - swears at the fact that it can not kill all the same java.sun.com . I decided to study the problems with this domain in more detail. But he does not ping at all! I tried traceroute - timeout occurs somewhere in the provider area or a little further. Through the mobile network everything works. Those. either the provider or the one who sells the channel to him does not know where to go.



It is impossible to work this way, at first I wanted to download the necessary file through the channels through which it is available and put it on my server. But later, on the recommendation of a colleague, I tried to remove the schema definition from the xml file in general. And lo and behold! Everything worked, no one swears. I publish the text of the exception here in case someone else steps on it - loading the article will save yourself a couple of hours:



Exception
  java.net.ConnectException: Connection timed out: connect
         at java.net.DualStackPlainSocketImpl.connect0 (Native Method)
         at java.net.DualStackPlainSocketImpl.socketConnect (Unknown Source)
         at java.net.AbstractPlainSocketImpl.doConnect (Unknown Source)
         at java.net.AbstractPlainSocketImpl.connectToAddress (Unknown Source)
         at java.net.AbstractPlainSocketImpl.connect (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 sun.net.NetworkClient.doConnect (Unknown Source)
         at sun.net.www.http.HttpClient.openServer (Unknown Source)
         at sun.net.www.http.HttpClient.openServer (Unknown Source)
         at sun.net.www.http.HttpClient. <init> (Unknown Source)
         at sun.net.www.http.HttpClient.New (Unknown Source)
         at sun.net.www.http.HttpClient.New (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect0 (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection $ 6.run (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection $ 6.run (Unknown Source)
         at java.security.AccessController.doPrivileged (Native Method)
         at java.security.AccessController.doPrivilegedWithCombiner (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.plainConnect (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.connect (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream0 (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.access $ 200 (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection $ 9.run (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection $ 9.run (Unknown Source)
         at java.security.AccessController.doPrivileged (Native Method)
         at java.security.AccessController.doPrivilegedWithCombiner (Unknown Source)
         at sun.net.www.protocol.http.HttpURLConnection.getInputStream (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl $ DTDDriver.dispatch (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl $ DTDDriver.next (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl $ PrologDriver.next (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (Unknown Source)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (Unknown Source)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (Unknown Source)
         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl $ JAXPSAXParser.parse (Unknown Source)
         at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse (Unknown Source)
         at org.eclipse.jetty.xml.XmlParser.parse (XmlParser.java:255)
         at org.eclipse.jetty.webapp.Descriptor.parse (Descriptor.java:54)
         at org.eclipse.jetty.webapp.WebDescriptor.parse (WebDescriptor.java:207)
         at org.eclipse.jetty.webapp.MetaData.setWebXml (MetaData.java:189)
         at org.eclipse.jetty.webapp.WebXmlConfiguration.preConfigure (WebXmlConfiguration.java:60)
         at org.eclipse.jetty.webapp.WebAppContext.preConfigure (WebAppContext.java:474)
         at org.eclipse.jetty.webapp.WebAppContext.doStart (WebAppContext.java min10)
         at org.eclipse.jetty.util.component.AbstractLifeCycle.start (AbstractLifeCycle.java:68)
         at com.earldouglas.xsbtwebplugin.Jetty9Runner.reload (Jetty9Runner.scala: 143)
         at com.earldouglas.xsbtwebplugin.Container $$ anonfun $ reloadTask $ 1 $$ anonfun $ apply $ 3.apply (Container.scala: 117)
         at com.earldouglas.xsbtwebplugin.Container $$ anonfun $ reloadTask $ 1 $$ anonfun $ apply $ 3.apply (Container.scala: 117)
         at scala.Function2 $$ anonfun $ tupled $ 1.apply (Function2.scala: 54)
         at scala.Function2 $$ anonfun $ tupled $ 1.apply (Function2.scala: 53)
         at scala.Function1 $$ anonfun $ compose $ 1.apply (Function1.scala: 47)
         at sbt. $ tilde $ greater $$ anonfun $$ u2219 $ 1.apply (TypeFunctions.scala: 40)
         at sbt.std.Transform $$ anon $ 4.work (System.scala: 63)
         at sbt.Execute $$ anonfun $ submit $ 1 $$ anonfun $ apply $ 1.apply (Execute.scala: 226)
         at sbt.Execute $$ anonfun $ submit $ 1 $$ anonfun $ apply $ 1.apply (Execute.scala: 226)
         at sbt.ErrorHandling $ .wideConvert (ErrorHandling.scala: 17)
         at sbt.Execute.work (Execute.scala: 235)
         at sbt.Execute $$ anonfun $ submit $ 1.apply (Execute.scala: 226)
         at sbt.Execute $$ anonfun $ submit $ 1.apply (Execute.scala: 226)
         at sbt.ConcurrentRestrictions $$ anon $ 4 $$ anonfun $ 1.apply (ConcurrentRestrictions.scala: 159)
         at sbt.CompletionService $$ anon $ 2.call (CompletionService.scala: 28)
         at java.util.concurrent.FutureTask.run (Unknown Source)
         at java.util.concurrent.Executors $ RunnableAdapter.call (Unknown Source)
         at java.util.concurrent.FutureTask.run (Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor.runWorker (Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor $ Worker.run (Unknown Source)
         at java.lang.Thread.run (Unknown Source) 




Now the provider's address also pings, apparently the problem has withdrawn itself.



And yes, perhaps, after a careful study of the glass eye stack, it would still catch on the line com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity and it would become clear that this is exactly the case. But IMHO, the address to which you could not connect, it is necessary to write exceptions in the text! I don’t know where to submit patches for the com.sun.org code, I haven’t sent any reports yet.



PS java.sun.com now is CNAME at www-legacy.oraclegha.com . Perhaps it is so legacy that it somehow became the cause.

Source: https://habr.com/ru/post/277373/



All Articles