could not start a new session on selenium webdriver
<p>I'm trying to open firefox browser using selenium java code.</p>

<pre><code>System.setProperty("webdriver.gecko.driver", "  System.setProperty("webdriver.gecko.driver", "C:/Program Files/Mozilla Firefox/geckodriver-v0.8.0-win32/geckodriver.exe");

WebDriver driver = new FirefoxDriver();
System.setProperty("webdriver.firefox.port","4444");
</code></pre>

<p>The Selenium server is up and running. I tried to change the selenium server port using command prompt and set the port in code, but neither of them works.</p>

<pre><code>&gt; Exception in thread "main" 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: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:247)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:130)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:232)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:220)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:215)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:124)
    at newpackage.Gmail_Login.main(Gmail_Login.java:18)
Caused by: org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:6544 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
Build info: version: 'unknown', revision: '2aa21c1', time: '2016-08-02 14:59:43 -0700'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:91)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:649)
    ... 8 more
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:6544 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:158)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute(ApacheHttpClient.java:142)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.execute(ApacheHttpClient.java:88)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    ... 9 more
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(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 org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket(PlainConnectionSocketFactory.java:74)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:141)
    ... 22 more
</code></pre>

<p>In the error message, "Connect to localhost:6544" it tried to connect to a different localhost everytime. Can anyone see where the problem is?</p>

<p>The versions I'm using are:</p>

<ul>
<li>firefox 48.0 </li>
<li>selenium 3.0.0 beta 2 </li>
<li>windows 7 32 bits</li>
<li>geckodriver-v0.8.0-win32 </li>
</ul>

<p>Also my geckodriver executable isn't running, it says VCRUNTIME140.dill is missing and I should reinstall to fix the problem. But after I reinstalled it, same thing happened.</p>

<hr>

<p>updates</p>

<p>Thanks for @Saurabh's suggestion, I downgraded my selenium to 2.53.1. The browser is opening now, but nothing shows up. And I got another error</p>

<pre><code>    org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157   DeferredSave.extensions.json    DEBUG   Save changes
1471356838157   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1471356838157   addons.xpi-utils    DEBUG   Updating add-on states
1471356838158   addons.xpi-utils    DEBUG   Writing add-ons list
1471356838161   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1471356838162   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.4
1471356838163   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1471356838164   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.4.3
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1471356838181   addons.manager  DEBUG   Provider finished startup: XPIProvider
1471356838181   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1471356838181   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1471356838182   addons.manager  DEBUG   Starting provider: GMPProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: GMPProvider
1471356838187   addons.manager  DEBUG   Starting provider: PluginProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: PluginProvider
1471356838188   addons.manager  DEBUG   Completed startup sequence
1471356839788   addons.manager  DEBUG   Starting provider: &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Registering shutdown blocker for &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Provider finished startup: &lt;unnamed-provider&gt;
1471356840362   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840362   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1471356840362   DeferredSave.extensions.json    DEBUG   Starting timer
1471356840374   addons.repository   DEBUG   No addons.json found.
1471356840374   DeferredSave.addons.json    DEBUG   Save changes
1471356840377   DeferredSave.addons.json    DEBUG   Starting timer
1471356840413   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1471356840421   DeferredSave.extensions.json    DEBUG   Starting write
1471356840440   DeferredSave.addons.json    DEBUG   Starting write
1471356840460   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840495   DeferredSave.addons.json    DEBUG   Write succeeded

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:119)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:218)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:129)
    at newpackage.Gmail_Login.main(Gmail_Login.java:25)
Exception in thread "main" org.openqa.selenium.WebDriverException: Failed to connect to binary FirefoxBinary(C:\Program Files\Mozilla Firefox\firefox.exe) on port 7055; process output follows: 
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157   DeferredSave.extensions.json    DEBUG   Save changes
1471356838157   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1471356838157   addons.xpi-utils    DEBUG   Updating add-on states
1471356838158   addons.xpi-utils    DEBUG   Writing add-ons list
1471356838161   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1471356838162   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.4
1471356838163   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1471356838164   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.4.3
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1471356838181   addons.manager  DEBUG   Provider finished startup: XPIProvider
1471356838181   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1471356838181   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1471356838182   addons.manager  DEBUG   Starting provider: GMPProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: GMPProvider
1471356838187   addons.manager  DEBUG   Starting provider: PluginProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: PluginProvider
1471356838188   addons.manager  DEBUG   Completed startup sequence
1471356839788   addons.manager  DEBUG   Starting provider: &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Registering shutdown blocker for &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Provider finished startup: &lt;unnamed-provider&gt;
1471356840362   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840362   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1471356840362   DeferredSave.extensions.json    DEBUG   Starting timer
1471356840374   addons.repository   DEBUG   No addons.json found.
1471356840374   DeferredSave.addons.json    DEBUG   Save changes
1471356840377   DeferredSave.addons.json    DEBUG   Starting timer
1471356840413   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1471356840421   DeferredSave.extensions.json    DEBUG   Starting write
1471356840440   DeferredSave.addons.json    DEBUG   Starting write
1471356840460   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840495   DeferredSave.addons.json    DEBUG   Write succeeded

Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:09'
System info: host: 'W0045395', ip: '10.17.208.124', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: FirefoxDriver
    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:124)
    at org.openqa.selenium.firefox.FirefoxDriver.startClient(FirefoxDriver.java:271)
    at org.openqa.selenium.remote.RemoteWebDriver.&lt;init&gt;(RemoteWebDriver.java:119)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:218)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:211)
    at org.openqa.selenium.firefox.FirefoxDriver.&lt;init&gt;(FirefoxDriver.java:129)
    at newpackage.Gmail_Login.main(Gmail_Login.java:25)
Caused by: org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
ateKey":null,"optionsURL":null,"optionsType":null,"aboutURL":null,"icons":{},"iconURL":"chrome://web2pdfextension/skin/C_AdobeLogo_48x48.png","icon64URL":"chrome://web2pdfextension/skin/C_AdobeLogo_64x64.png","defaultLocale":{"name":"Adobe Acrobat DC - Create PDF","description":"Converts a web page to PDF","creator":"Adobe Systems Incorporated","homepageURL":"http://www.adobe.com/"},"visible":true,"active":false,"userDisabled":true,"appDisabled":false,"descriptor":"C:\\Program Files\\Adobe\\Acrobat DC\\Acrobat\\Browser\\WCFirefoxExtn","installDate":1463491629403,"updateDate":1463491629403,"applyBackgroundUpdates":1,"bootstrap":false,"skinnable":false,"size":345393,"sourceURI":null,"releaseNotesURI":null,"softDisabled":false,"foreignInstall":true,"hasBinaryComponents":false,"strictCompatibility":false,"locales":[],"targetApplications":[{"id":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","minVersion":"4.0","maxVersion":"46.0"}],"targetPlatforms":[],"multiprocessCompatible":false,"signedState":2,"seen":true}
1471356838157   DeferredSave.extensions.json    DEBUG   Save changes
1471356838157   addons.xpi  DEBUG   Updating database with changes to installed add-ons
1471356838157   addons.xpi-utils    DEBUG   Updating add-on states
1471356838158   addons.xpi-utils    DEBUG   Writing add-ons list
1471356838161   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\e10srollout@mozilla.org.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on e10srollout@mozilla.org version 1.0
1471356838162   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\firefox@getpocket.com.xpi
1471356838162   addons.xpi  DEBUG   Calling bootstrap method startup on firefox@getpocket.com version 1.0.4
1471356838163   addons.xpi  DEBUG   Registering manifest for C:\Program Files\Mozilla Firefox\browser\features\loop@mozilla.org.xpi
1471356838164   addons.xpi  DEBUG   Calling bootstrap method startup on loop@mozilla.org version 1.4.3
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for XPIProvider
1471356838181   addons.manager  DEBUG   Provider finished startup: XPIProvider
1471356838181   addons.manager  DEBUG   Starting provider: LightweightThemeManager
1471356838181   addons.manager  DEBUG   Registering shutdown blocker for LightweightThemeManager
1471356838181   addons.manager  DEBUG   Provider finished startup: LightweightThemeManager
1471356838182   addons.manager  DEBUG   Starting provider: GMPProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for GMPProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: GMPProvider
1471356838187   addons.manager  DEBUG   Starting provider: PluginProvider
1471356838187   addons.manager  DEBUG   Registering shutdown blocker for PluginProvider
1471356838187   addons.manager  DEBUG   Provider finished startup: PluginProvider
1471356838188   addons.manager  DEBUG   Completed startup sequence
1471356839788   addons.manager  DEBUG   Starting provider: &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Registering shutdown blocker for &lt;unnamed-provider&gt;
1471356839788   addons.manager  DEBUG   Provider finished startup: &lt;unnamed-provider&gt;
1471356840362   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840362   addons.xpi-utils    DEBUG   XPI Database saved, setting schema version preference to 17
1471356840362   DeferredSave.extensions.json    DEBUG   Starting timer
1471356840374   addons.repository   DEBUG   No addons.json found.
1471356840374   DeferredSave.addons.json    DEBUG   Save changes
1471356840377   DeferredSave.addons.json    DEBUG   Starting timer
1471356840413   addons.manager  DEBUG   Starting provider: PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Registering shutdown blocker for PreviousExperimentProvider
1471356840413   addons.manager  DEBUG   Provider finished startup: PreviousExperimentProvider
1471356840421   DeferredSave.extensions.json    DEBUG   Starting write
1471356840440   DeferredSave.addons.json    DEBUG   Starting write
1471356840460   DeferredSave.extensions.json    DEBUG   Write succeeded
1471356840495   DeferredSave.addons.json    DEBUG   Write succeeded

    at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:112)
    ... 6 more
</code></pre>