You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behaviour is repeated across the project and also in different projects in which the library is used.
Steps to Reproduce the Problem
Download the repository and extract
Open command prompt or git bash in the extracted folder
run mvn test or run from within the IDE.
browserstack local arguments
I have run the repository out of the box and changed no settings. I know that my Browserstack access credentials are correct and non-local tests run OK.
Platform details
browserstack-local-java version: 1.0.1
java version: 1.8
os type and version: Windows 10
Details
the command Local.start() does not appear to function correctly and throws an error when invoked. The function new Local(); works OK and returns an object. The hashmap contains the correct elements.
Additional info: It appears the error is occurring due to an issue with my browserstack local (although it says it is enabled, I can't visit local pages manually either). For this I have submitted a support request. However, the error is confusing. It should report back that the local test environment is disconnected, which it doesn't do. I attach a screenshot showing the fact it's disconnected.
I am seeing the same issue when I ran the example Class as well separately just as a Java class:
Exception in thread "main" org.json.JSONException: JSONObject["message"] is not a JSONObject.
at org.json.JSONObject.getJSONObject(JSONObject.java:640)
at com.browserstack.local.Local.start(Local.java:80)
at BrowserStackLocalExample.main(BrowserStackLocalExample.java:36)
For the following lines:
l = new Local();
HashMap<String, String> options = new HashMap<String, String>();
options.put("key", access_key); l.start(options); //Above mentioned error is thrown at this line
I have tried with the following browserstack local versions:
1.0.3,1.0.2, 1.0.1, 1.0.0
My Browserstack access credentials are correct and non-local tests ran without any connectivity issues.
Platform Details:
Maven - 3.3.9
Browsertack local dependency added in POM:
com.browserstack
browserstack-local-java
1.0.0
UPDATE:****
When I tried with Browserstack Local version 0.3.0, then the following error message is thrown:
Exception in thread "main" com.browserstack.local.LocalException: Disconnected
at com.browserstack.local.Local.start(Local.java:78)
After careful debugging, I found there is some issue at these lines inside the Local.class:
protected LocalProcess runCommand(List command) throws IOException {
ProcessBuilder processBuilder = new ProcessBuilder(command);
final Process process = processBuilder.start();
Maybe the right list of commands is not passed to the processbuilder.
After some more analysis, I found the following method in Local.class file to run the command , even when we ran it manually from command line it throws the same error:
I get the same error even with the latest release v8.0.1.
I am starting Browserstack Local in a linux container running in OpenShift.
This issue appears since 25. May. before we had no problems.
here is the error :
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
| at org.json.JSONTokener.syntaxError(JSONTokener.java:433) ~[json-20160212.jar!/:na]
| at org.json.JSONObject.(JSONObject.java:195) ~[json-20160212.jar!/:na]
| at org.json.JSONObject.(JSONObject.java:319) ~[json-20160212.jar!/:na]
| at com.browserstack.local.Local.start(Local.java:78) ~[browserstack-local-java-1.0.3.jar!/:na]
Activity
HesterLyons commentedon Jan 22, 2019
Additional info: It appears the error is occurring due to an issue with my browserstack local (although it says it is enabled, I can't visit local pages manually either). For this I have submitted a support request. However, the error is confusing. It should report back that the local test environment is disconnected, which it doesn't do. I attach a screenshot showing the fact it's disconnected.
State of connection:

ramapriyamk commentedon Feb 6, 2019
I am seeing the same issue when I ran the example Class as well separately just as a Java class:
Exception in thread "main" org.json.JSONException: JSONObject["message"] is not a JSONObject.
at org.json.JSONObject.getJSONObject(JSONObject.java:640)
at com.browserstack.local.Local.start(Local.java:80)
at BrowserStackLocalExample.main(BrowserStackLocalExample.java:36)
For the following lines:
l = new Local();
HashMap<String, String> options = new HashMap<String, String>();
options.put("key", access_key);
l.start(options); //Above mentioned error is thrown at this line
I have tried with the following browserstack local versions:
1.0.3,1.0.2, 1.0.1, 1.0.0
My Browserstack access credentials are correct and non-local tests ran without any connectivity issues.
Platform Details:
- Maven - 3.3.9
- Browsertack local dependency added in POM:
com.browserstack browserstack-local-java 1.0.0UPDATE:****
When I tried with Browserstack Local version 0.3.0, then the following error message is thrown:
Exception in thread "main" com.browserstack.local.LocalException: Disconnected
at com.browserstack.local.Local.start(Local.java:78)
After careful debugging, I found there is some issue at these lines inside the Local.class:
protected LocalProcess runCommand(List command) throws IOException {
ProcessBuilder processBuilder = new ProcessBuilder(command);
final Process process = processBuilder.start();
Maybe the right list of commands is not passed to the processbuilder.
ramapriyamk commentedon Feb 6, 2019
After some more analysis, I found the following method in Local.class file to run the command , even when we ran it manually from command line it throws the same error:
private void makeCommand(Map<String, String> options, String opCode) {
command = new ArrayList();
command.add(binaryPath);
command.add("-d");
command.add(opCode);
command.add("--key");
command.add(options.get("key"));
In the above method if we remove the two lines and run then I think the local test might get enabled (though not sure what else might break)
manually running this command from source directory:

Just by running-
BrowserStackLocal.exe -- key yourAccessKeyValue
The local connection is established without issues.
artemklimenkov-qa commentedon Feb 18, 2020
I am seeing the same issue. Any updates on this?
RohanImmanuel commentedon May 4, 2020
@artemklimenkov-qa could you confirm if you are encountering the same error with browserstack local v8.0
https://www.browserstack.com/local-testing/releases/v8.0
schurik commentedon May 27, 2020
I get the same error even with the latest release v8.0.1.
I am starting Browserstack Local in a linux container running in OpenShift.
This issue appears since 25. May. before we had no problems.
here is the error :
Caused by: org.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1]
| at org.json.JSONTokener.syntaxError(JSONTokener.java:433) ~[json-20160212.jar!/:na]
| at org.json.JSONObject.(JSONObject.java:195) ~[json-20160212.jar!/:na]
| at org.json.JSONObject.(JSONObject.java:319) ~[json-20160212.jar!/:na]
| at com.browserstack.local.Local.start(Local.java:78) ~[browserstack-local-java-1.0.3.jar!/:na]
What about this issue: #29
It seems to be related!