testng-team / testng-eclipse

Eclipse plug-in for TestNG
https://testng.org
194 stars 164 forks source link

Usage behind corporate (and authenticated) proxy is not possible since v7.1.1 #505

Closed axel3rd closed 4 years ago

axel3rd commented 4 years ago

Problem Statement

When TestNG for Eclipse Plugin is used behind a corporate (authenticated) proxy, any execution throws a UnknownHostException: testng.org.

Even if :

The problem has been introduced in v7.1.1 of plugin (it was fine in v7.1.0).

I didn't found any way to disable Xerces validation 😢.

Console log error

[RemoteTestNG] revisions:
    git.commit.id=bd89e41
    git.branch=bd89e41e24abcef9744ecb0bcc85e3262ee54589
    git.build.version=1.4.0
[RemoteTestNG] loaded class org.testng.internal.Version at file:/C:/Users/foobar/.m2/repository/org/testng/testng/6.8/testng-6.8.jar
[RemoteTestNG] detected TestNG version 6.8.0
[RemoteTestNG] Invoked with -serport 63149 -protocol json -d C:\Users\foobar\git\project\test-output C:\Users\foobar\AppData\Local\Temp\testng-eclipse-614614144\testng-customsuite.xml 
[BaseMessageSender] Waiting for Eclipse client on localhost:63149
[BaseMessageSender] Received a connection from Eclipse on localhost:63149
[BaseMessageSender] Connection established, starting reader thread
[BaseMessageSender] ReaderThread waiting for an admin message
org.testng.TestNGException: java.net.UnknownHostException: testng.org
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:340)
    at org.testng.remote.AbstractRemoteTestNG.initialize(AbstractRemoteTestNG.java:137)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:98)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
Caused by: java.net.UnknownHostException: testng.org
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
    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 sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:666)
    at sun.security.ssl.BaseSSLSocketImpl.connect(BaseSSLSocketImpl.java:173)
    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
    at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
    at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:263)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1304)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDTDEntity(XMLEntityManager.java:1270)
    at com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl.setInputSource(XMLDTDScannerImpl.java:264)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.dispatch(XMLDocumentScannerImpl.java:1161)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$DTDDriver.next(XMLDocumentScannerImpl.java:1045)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:959)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
    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:643)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
    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:172)
    at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
    ... 4 more
java.net.SocketException: Socket closed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
    at java.net.SocketInputStream.read(SocketInputStream.java:171)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
    at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
    at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
    at java.io.InputStreamReader.read(InputStreamReader.java:184)
    at java.io.BufferedReader.fill(BufferedReader.java:161)
    at java.io.BufferedReader.readLine(BufferedReader.java:324)
    at java.io.BufferedReader.readLine(BufferedReader.java:389)
    at org.testng.remote.strprotocol.BaseMessageSender$ReaderThread.run(BaseMessageSender.java:245)

The Dependency Management tool for your project

Operating System

missedone commented 4 years ago

looks like it fails when retrieving DTD file from testng.org. given the error UnknownHostException: testng.org looks like DNS issue rather than http proxy, could you check the DNS settings or if you're using company DNS and IT can't add testng.org to resolve list, then we don't have much choice here.

@krmahadevan do you have any suggestion?

axel3rd commented 4 years ago

@missedone Thanks for your feedback.

could you check the DNS settings or if you're using company DNS and IT can't add testng.org to resolve list, then we don't have much choice here

This is not possible, any internet domain resolution should be done by using the proxy. I agree this is a painful usage in development 😁, but this is for security reason, not negotiable 😢.


Beyond this proxy problem, the question is: why internet connection is required to execute TestNG ?. If I switch my computer in "Airplane mode" (without internet access), I should be able to continue to execute my tests (if no external connection is required) !

That said : On a personal computer (without proxy) without internet connection, I can reproduce the problem on a snippet project (java.net.UnknownHostException: testng.org). But switching dependency org.testng.testng from 6.8 to 7.3.0, the problem disappear.

I was thinking that the root cause was the Eclipse plugin (because problem appears after an Eclipse plugin update), but testng project dependency is in the game.

=> I will do more tests but upgrade project testng version could solve the problem.

axel3rd commented 4 years ago

Problem is fixed by using any v7.x TestNG version (as dependency project)

missedone commented 4 years ago

link https://github.com/cbeust/testng/pull/2386 fixes this issue