Java.net.BindException: Selenium is already running on port 4444. Or some other service is.
When I try run my test.
selenium-standalone start
10:51:37.031 INFO - Launching a standalone Selenium Server Setting system property webdriver.chrome.driver to /usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.21-x64-chromedriver 10:51:37.071 INFO - Java: Oracle Corporation 25.74-b02 10:51:37.072 INFO - OS: Mac OS X 10.11.3 x86_64 10:51:37.083 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b 10:51:37.160 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC 10:51:37.160 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped: registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC 10:51:37.161 INFO - Driver class not found: com.opera.core.systems.OperaDriver 10:51:37.161 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 10:51:37.163 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver 10:51:37.163 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered 10:51:37.249 WARN - Failed to start: [email protected]:4444
Running as a standalone server:
Usage: java -jar selenium-server.jar [-interactive] [options]
-port
-dontInjectRegex <regex>: an optional regular expression that
proxy injection mode can use to know when to bypss injection
-userJsInjection <file>: specifies a JavaScript file which will
then be injected into all pages
-userContentTransformation <regex> <replacement>: a regular
expression which is matched against all test HTML content; the
second is a string which will replace matches. These flags can
be used any number of times. A simple example of how this could
be useful: if you add "-userContentTransformation https http"
then all "https" strings in the HTML of the test application will
be changed to be "http".
This synopsis lists options available in standalone role only. To get help on the options available for other roles run the server with -help option and the corresponding -role option value. 10:51:37.031 INFO - Launching a standalone Selenium Server Setting system property webdriver.chrome.driver to /usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.21-x64-chromedriver 10:51:37.071 INFO - Java: Oracle Corporation 25.74-b02 10:51:37.072 INFO - OS: Mac OS X 10.11.3 x86_64 10:51:37.083 INFO - v2.53.0, with Core v2.53.0. Built from revision 35ae25b 10:51:37.160 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC 10:51:37.160 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped: registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC 10:51:37.161 INFO - Driver class not found: com.opera.core.systems.OperaDriver 10:51:37.161 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered 10:51:37.163 INFO - Driver class not found: org.openqa.selenium.htmlunit.HtmlUnitDriver 10:51:37.163 INFO - Driver provider org.openqa.selenium.htmlunit.HtmlUnitDriver is not registered 10:51:37.249 WARN - Failed to start: [email protected]:4444
Running as a standalone server:
Usage: java -jar selenium-server.jar [-interactive] [options]
-port
-dontInjectRegex <regex>: an optional regular expression that
proxy injection mode can use to know when to bypss injection
-userJsInjection <file>: specifies a JavaScript file which will
then be injected into all pages
-userContentTransformation <regex> <replacement>: a regular
expression which is matched against all test HTML content; the
second is a string which will replace matches. These flags can
be used any number of times. A simple example of how this could
be useful: if you add "-userContentTransformation https http"
then all "https" strings in the HTML of the test application will
be changed to be "http".
This synopsis lists options available in standalone role only. To get help on the options available for other roles run the server with -help option and the corresponding -role option value. java.net.BindException: Selenium is already running on port 4444. Or some other service is. at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:509) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:321) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:240) at org.openqa.grid.selenium.GridLauncher$1.launch(GridLauncher.java:58) at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127) /usr/local/lib/node_modules/selenium-standalone/bin/selenium-standalone:61 throw err; ^
Error: Selenium exited before it could start at ChildProcess.errorIfNeverStarted (/usr/local/lib/node_modules/selenium-standalone/lib/start.js:123:15) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:509) at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:321) at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:240) at org.openqa.grid.selenium.GridLauncher$1.launch(GridLauncher.java:58) at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:127) /usr/local/lib/node_modules/selenium-standalone/bin/selenium-standalone:61 throw err; ^
Error: Selenium exited before it could start at ChildProcess.errorIfNeverStarted (/usr/local/lib/node_modules/selenium-standalone/lib/start.js:123:15) at emitTwo (events.js:87:13) at ChildProcess.emit (events.js:172:7) at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
Sounds like another process is already using the default port 4444. What shows when you use lsof?
$ lsof -iTCP:4444 -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 68351 sash 27u IPv6 0x9f7c11046a64cdbd 0t0 TCP *:krb524 (LISTEN)
$ ps aux | grep 68351
sash 68400 0.0 0.0 2432772 676 s003 S+ 9:34AM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn 68351
sash 68351 0.0 0.4 8275932 73444 s000 S+ 9:34AM 0:00.98 java -jar /usr/local/lib/node_modules/selenium-standalone/.selenium/selenium-server/2.48.2-server.jar -Dwebdriver.chrome.driver=/usr/local/lib/node_modules/selenium-standalone/.selenium/chromedriver/2.20-x64-chromedriver
You can also specify a different port to start with to get around collisions:
$ selenium-standalone start -- -port 4445
09:30:43.993 INFO - Launching a standalone Selenium Server
Setting system property webdriver.chrome.driver to /usr/local/lib/selenium-standalone/.selenium/chromedriver/2.20-x64-chromedriver
09:30:44.028 INFO - Java: Oracle Corporation 25.45-b02
09:30:44.028 INFO - OS: Mac OS X 10.10.5 x86_64
09:30:44.038 INFO - v2.48.0, with Core v2.48.0. Built from revision 41bccdd
09:30:44.099 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:
registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform MAC
09:30:44.099 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:
registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform MAC
09:30:44.099 INFO - Driver class not found: com.opera.core.systems.OperaDriver
09:30:44.099 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
09:30:44.182 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4445/wd/hub
09:30:44.182 INFO - Selenium Server is up and running
Selenium started
We are seeing the same exact problem as above. When we run the lsof command suggested, nothing is returned.
There are already multiple issues about this and somewhere someone must have found something, did you had a look at previous issues?