Forum Discussion

tiegs's avatar
tiegs
New Member
10 years ago

[Possible Bug] SoapUI 5 is setting default proxyselector to null

Hello,

 

first off I'm not sure if this is the right place to report the issue. I did not find a bugtracker or so, so I'm posting this here. Sorry for any inconvenience.

 

 

I'm using SoapUI 5 in a java project on Windows 7 with java SDK 1.7.

 

Used Jar-versions (using maven):
SoapUI Pro v 5.1.2 (soapui-pro-maven-plugin)
Selenium 2.45 is used (selenium-java)
httpclient 4.3.6 is used

 

When using SoapUI and selenium, selenium is not able to communicate with its webdriver (it does so via apache httpclient).

 

Reproduction:

WsdlProject wsdlProject = new WsdlProject("");
WebDriver driver = new FirefoxDriver();

Leads to:

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26'
System info: host: 'xxx', ip: 'XXX.XXX.XXX.XXX', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_75'
Driver info: driver.version: FirefoxDriver
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:593)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:126)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:191)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:186)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:182)
at org.openqa.selenium.firefox.FirefoxDriver.(FirefoxDriver.java:95)
at my.project.selenium.webdriver.test.foo(awda.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
at org.testng.SuiteRunner.run(SuiteRunner.java:254)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:125)

The reason appears to be that SoapUI is setting the default proxyselector to null.

 

The issue can be worked around by setting it back:

ProxySelector proxy = ProxySelector.getDefault();
WsdlProject wsdlProject = new WsdlProject("");
ProxySelector.setDefault(proxy);
WebDriver driver = new FirefoxDriver();

 

I filed a bug for selenium (https://github.com/SeleniumHQ/selenium/issues/388) they think its an issue with SoapUI so I'm writing this post.

 

peidong-hu had a simmilar issue in selenium-standalone-server-plugin:
https://github.com/Ardesco/selenium-standalone-server-plugin/issues/23

 

 Additional Info:

 

Spoiler

Code:

@Test
    public void foo() throws XmlException, IOException {

        ProxySelector proxy = ProxySelector.getDefault();

        System.out.println("BEFORE: " + ProxySelector.getDefault());

        try {
            WsdlProject wsdlProject = new WsdlProject("XXX");
        } catch (SoapUIException e) {
            e.printStackTrace();
        }

        System.out.println("AFTER: " + ProxySelector.getDefault());

        ProxySelector.setDefault(proxy);

        WebDriver driver = new FirefoxDriver();
    }

Result:

[TestNG] Running:

BEFORE: sun.net.spi.DefaultProxySelector@146d950
11:23:04,657 WARN  [SoapUI] Missing folder [XXX] for external libraries
11:23:04,974 INFO  [DefaultSoapUICore] initialized soapui-settings from [XXX]
11:23:06,021 INFO  [WsdlProject] Loaded project from [XXX]
AFTER: null

===============================================
Custom suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

Disconnected from the target VM, address: '127.0.0.1:53425', transport: 'socket'

Process finished with exit code 0

 

 

8 Replies

  • AntonE's avatar
    AntonE
    SmartBear Alumni (Retired)

    The fix will be included in 5.7.0.

  • nmrao's avatar
    nmrao
    Champion Level 3
    Obsolutely, fine. For SoapUI Open Source, you may report the issues here.
    • jimsefton's avatar
      jimsefton
      Occasional Visitor

      Hi,

       

      Any update on this. I am getting the same error... tried using the following workaround but it's not working:

       

      import org.openqa.selenium.WebDriver 
      import org.openqa.selenium.firefox.FirefoxDriver
      
      ProxySelector proxy = ProxySelector.getDefault();
      ProxySelector.setDefault(proxy);
      
      WebDriver driver = new FirefoxDriver();
      
          driver.get("http://localhost ") 
          log.info("Pagee is: " + driver.getTitle()) 
          driver.quit()

      Any suggestions of a fix or workaround would be appreciated. Thanks

      • wind19862006's avatar
        wind19862006
        New Contributor
        ProxySelector proxy = ProxySelector.getDefault();
        ProxySelector.setDefault(proxy);

        This will do nothing. You need to get  

        ProxySelector proxy = ProxySelector.getDefault();

        before you run SOAPUI to save proxy and then  

        ProxySelector.setDefault(proxy);

        to reset it and make sure proxy won't be null when you initiate selenium webdriver.

         

    • wind19862006's avatar
      wind19862006
      New Contributor

      Is there any plan from SoapUI Open Source team to fix this? 

       

      I have been using the work around solution for 2 years but recently we decide to enable paralell execution for our test to improve performance. 

       

      That means if we have no real fix for this issue, then it might still interupt webdriver instance like race codition. 

       

      This is actually blocking SOAPUI to be considered as API testing solution for many projects where selenium is also selected. 

       

      Please consider to provide a fix on it. It will be such a easy fix. 

       

      Or at least tell me, in which class SOAPUI api actually set the proxy to null so I can overwite it in my project. 

       

      I appreciate any update you can provide. 

       

      • class101's avatar
        class101
        Frequent Visitor

        Hello I just registered in here to share on this issue that I consider blocking and I believe the Smartbear developers completely under estimate the severity of it, so at least the error log of our Jenkins integration build will be search friendly and people having the same issue will voice up until they finally decide to fix.

        Small introduction about myself, I'm responsible on DevOps operations in a development team at Accenture and the principal tools I'm operating with are;

        Maven 3.3.9 Jenkins 2.x and soapui-maven-plugin 5.2.1 => PROXY BUG IN JENKINS => proxySelector == null


        [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project parent: Fail to download libraries from server: proxySelector == null -> [Help 1]
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

        This has been hard for me to track the real cause of this issue and this thread entirely reveal the truth, I was smelling an issue around this plugin but not Sonar, and this is quite frustrating to see it has been known since more than a year ago !@# (my feeling)

        I'm sorry but in our Maven setup, we require a proxy to be set, but if you change it to null without our consent, 1) it's wrong 2) you are causing side issues in Jenkins/Maven integration builds for us, and Selenium for the people above me in this post, and probably lots of issues.