org.testng.TestNGException: java.net.ConnectException: Connection timed out: connect at org.testng.TestNG.

5,360 views
Skip to first unread message

Prashant Yelpale

unread,
Dec 1, 2015, 12:04:28 PM12/1/15
to testng-users
Hi All,


I am getting below error when running multiple cases as Single suite with TestNG

org.testng.TestNGException: java.net.ConnectException: Connection timed out: connect
    at org.testng.TestNG.
initializeSuitesAndJarFile(TestNG.java:335)
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:92)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:207)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:178)
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at java.net.Socket.connect(Socket.java:538)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:432)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:527)
    at sun.net.www.http.HttpClient.<init>(HttpClient.java:211)
    at sun.net.www.http.HttpClient.New(HttpClient.java:308)
    at sun.net.www.http.HttpClient.New(HttpClient.java:326)
    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1168)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1104)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:998)
    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:932)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1512)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1440)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:646)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1300)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1267)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:263)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1164)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1050)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:964)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:17)
    at org.testng.xml.SuiteXmlParser.parse(SuiteXmlParser.java:10)
    at org.testng.xml.Parser.parse(Parser.java:170)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:305)
    ... 3 more



Kindly Check and let me know what might be the root cause for this ?

Thanks,
Prashant

Krishnan Mahadevan

unread,
Dec 1, 2015, 9:46:08 PM12/1/15
to testng...@googlegroups.com
Prashant,

You haven't showed us what does your suite file look like ? How you are running your test ?
The complete stacktrace. [ I think this is not the complete stacktrace ]

What is the TestNG version that you are using in your CLASSPATH ?

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Julien Herr

unread,
Dec 2, 2015, 10:45:17 AM12/2/15
to testng-users
+1

I suppose your doctype is not the good one.

Javier Bernabe

unread,
Feb 6, 2020, 10:04:48 AM2/6/20
to testng-users
Julien Herr gave me the clue.  "I suppose your doctype is not the good one." and that´s true.

The solution is difficult to find but ease to solve. I know because it happened to me and took me many hours to find what was happening.

In the xml testNG file, the suite file, probably you have written this:
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
instead of 
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

So if you put the https protocol (secure http) it will give a connection timeout.
If you use simple http protocol everything will go ok.

That was exactly what it happened to me!!

Good luck!
Reply all
Reply to author
Forward
0 new messages