Need Help with Error Message: java.lang.RuntimeException: Could not start browser CommandLineBrowserRunner

514 views
Skip to first unread message

Tonté Pouncil

unread,
May 4, 2012, 5:40:36 PM5/4/12
to JsTestDriver
Hello,

What does the following error message mean? Does it mean it can not
start the browser that would be used as a slave?

Thank you.

Tonté

Running: java -classpath /home/hudson/.m2/repository/commons-io/
commons-io/1.4/commons-io-1.4.jar;/home/hudson/.m2/repository/commons-
lang/commons-lang/2.5/commons-lang-2.5.jar;/home/hudson/.m2/repository/
com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/
home/hudson/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-
utils-1.1.jar;/home/hudson/.m2/repository/org/jvnet/wagon-svn/wagon-
svn/1.8/wagon-svn-1.8.jar;/home/hudson/.m2/repository/org/jvnet/hudson/
svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/home/
hudson/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-
ssh2-build210.jar;/opt/maven/apache-maven-2.2.1/lib/maven-2.2.1-
uber.jar;/home/hudson/.m2/repository/org/apache/maven/artifact/maven-
artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/opt/maven/apache-
maven-2.2.1/lib/maven-2.2.1-uber.jar -jar /home/hudson/.m2/repository/
com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --
basePath /scratch/hudson/workspace/my-calendar-gui/my-calendar-gui --
browser open --captureConsole --config /scratch/hudson/workspace/my-
calendar-gui/my-calendar-gui/src/test/resources/jsTestDriver.conf --
port 9876 --tests all --verbose
Failures during test run.
Caused by:
java.lang.RuntimeException: Failed after 3 tries.
Failure 1: java.lang.RuntimeException: Could not start browser
CommandLineBrowserRunner [
browserPath=open,
process=java.lang.UNIXProcess@dc024a,
process log={
error:
[B@1a70b8
input:

}] in 30

Cory Smith

unread,
May 5, 2012, 9:19:09 AM5/5/12
to js-test...@googlegroups.com
It means the browser didn't start, or was unable to access the capture url.

-c
> --
> You received this message because you are subscribed to the Google Groups "JsTestDriver" group.
> To post to this group, send email to js-test...@googlegroups.com.
> To unsubscribe from this group, send email to js-test-drive...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/js-test-driver?hl=en.
>

Tonté Pouncil

unread,
May 7, 2012, 8:04:40 AM5/7/12
to js-test...@googlegroups.com
Corey,

So, just to confirm the slave browser could not start, correct? So how can I start the server without starting the slave browser? The reason I need to do this is because I am planning on using a slave browser on a different machine. Or maybe I should be asking how to run test against a slave browser that is not local to the test server.

Thanks.

Tonté

Dan McWeeney

unread,
May 7, 2012, 11:04:06 AM5/7/12
to js-test...@googlegroups.com
You are probably pointing JSTD to a browser that is not installed on hudson.  You might want to make the browser path a maven property that you set or it detects based on OS.  Another option is to startup an always running JSTD server then point the build to send commands to that instead of starting one itself.  This is what I do as a nightly test to see how things are running across a "swarm" of browsers.  So the build doesn't start a server or a browser it just sends commands to an already running server.

It also looks like you are running the maven plugin so I you might want to read the source for the mojo[0] to see all the things you can set as maven properties. 

Tonté Pouncil

unread,
May 7, 2012, 12:04:40 PM5/7/12
to js-test...@googlegroups.com
I like your second option and would like to explore it.  Do you happen to have or know some where I can find a step-by-step instruction on how to actually do it?  

"Another option is to startup an always running JSTD server then point the build to send commands to that instead of starting one itself."

From what I can gather from what you are saying in the quote above is...  I can start the JSTD server without starting a slave browser.  And then some how send commands to the JSTD server instead of starting a slave browser.  

I am not sure I fully understand what commands I would send to the JSTD server from Maven; but that is what I am hoping your step-by-step instructions will tell me.

Ultimately, I would like to start the JSTD server without starting a slave browser.  Do you know how to do this?  That way I can tell my cloud base testing environment to connect to the JSTD server via the capture URL.  

Thank you.

Tonté

Dan McWeeney

unread,
May 7, 2012, 12:29:41 PM5/7/12
to js-test...@googlegroups.com
This will not start the JSTD during the build but assumes one is running "somewhere".  The problem with starting and stopping the server as part of the build is that the captured clients will lose their connection after the server is down for a period ( can't remember the timeout, a few minutes at most ).  So if you want the server to shutdown from what I can tell you  _must_ startup a browser on the build machine or use some other script to start one up remotely ( seems dicey ).

So this is very similar to debugging a JSTD Test [0]
1.  Start a server somewhere in your local network ( doesn't have to even be the build machine, mine isn't )
2.  Take one or more browsers and capture them on the server started in Step 1 
3.  Change your JSTD config to point at that server e.g ( again assuming you are using the JSTD Maven plugin  )
            <plugin>
                <groupId>com.googlecode.jstd-maven-plugin</groupId>
                <artifactId>jstd-maven-plugin</artifactId>
                <version>${jstd.plugin.version}</version>
                <configuration>
                    <server>http://thisIsWhereYouStartedJSTD:9876</server> <!-- usually <server>${jstd.server}</server> --> 
                    <port></port> <!-- usually <port>${jstd.port}</port> -->
                    <basePath>${basedir}</basePath>
                    <config>src-test/resources/jsTestDriver.conf</config>
                    <browser></browser> <!-- usually <browser>${jstd.localBrowser}</browser> -->
                    <testOutput>${basedir}/target/surefire-reports</testOutput>
                </configuration>
                <executions>
                    <execution>
                        <id>run-tests</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
4.  Test it locally, a browser should not start nor should a server ( although the second one is hard to tell ) but the tests will run.  If you watch a browser you did capture in Step 2 you will see the tests run.

In my normal build all these config parameters are maven properties, as show above, so they can be easily varied on the command line.  So when a developer wants to run a test they just run:
mvn compile test -Djstd.localBrowser="" -Djstd.server=http://localhost:9876 -Djstd.port=""

Hope that helps.
-d

Tonté Pouncil

unread,
May 7, 2012, 1:04:33 PM5/7/12
to js-test...@googlegroups.com
Dan,

I pretty much had the same maven configuration setup.  I just didn't know if there was other special commands I needed.  So it sounds like you are saying that I have to start up the JSTD server before running the Maven build.  Is this correct?  And then run the Maven build as you have describe and then maven will connect to the JSTD server?  And then the Maven build will wait for a period of time before it continues the build.  Is this all correct or did I get you wrong?

Anyway I get the below error; but I guess that is because I didn't start up the JSTD server before running the maven build, correct?

-------------------------------------------
 J S  T E S T  D R I V E R                 
-------------------------------------------

Running: java -classpath /Users/pouncilt/.m2/repository/com/googlecode/jstd-maven-plugin/jstd-maven-plugin/1.3.2.5/jstd-maven-plugin-1.3.2.5.jar;/Users/pouncilt/.m2/repository/commons-io/commons-io/1.4/commons-io-1.4.jar;/Users/pouncilt/.m2/repository/commons-lang/commons-lang/2.5/commons-lang-2.5.jar;/Users/pouncilt/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar;/Users/pouncilt/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.0-beta-3.0.1/plexus-component-annotations-1.0-beta-3.0.1.jar;/Users/pouncilt/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar;/Users/pouncilt/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar;/Users/pouncilt/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar;/Users/pouncilt/.m2/repository/com/google/code/google-collections/google-collect/snapshot-20080530/google-collect-snapshot-20080530.jar;/Users/pouncilt/.m2/repository/junit/junit/3.8.2/junit-3.8.2.jar;/Users/pouncilt/.m2/repository/org/apache/maven/artifact/maven-artifact/3.0-alpha-1/maven-artifact-3.0-alpha-1.jar;/Users/pouncilt/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.1/plexus-utils-1.5.1.jar;/Users/pouncilt/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar;/Users/pouncilt/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar;/Users/pouncilt/.m2/repository/org/codehaus/woodstox/wstx-asl/3.2.6/wstx-asl-3.2.6.jar;/Users/pouncilt/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar;/Users/pouncilt/.m2/repository/org/sonatype/spice/model-builder/1.0/model-builder-1.0.jar;/Users/pouncilt/.m2/repository/org/apache/maven/maven-project-builder/3.0-alpha-1/maven-project-builder-3.0-alpha-1.jar;/Users/pouncilt/.m2/repository/org/jvnet/wagon-svn/wagon-svn/1.8/wagon-svn-1.8.jar;/Users/pouncilt/.m2/repository/org/jvnet/hudson/svnkit/svnkit/1.1.4-hudson-4/svnkit-1.1.4-hudson-4.jar;/Users/pouncilt/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar -jar /Users/pouncilt/.m2/repository/com/google/jstestdriver/jstestdriver/1.3.2/jstestdriver-1.3.2.jar --basePath /Users/pouncilt/git/projects/my-calendar-gui/my-calendar-gui --captureConsole --config /Users/pouncilt/git/projects/my-calendar-gui/my-calendar-gui/src/test/resources/jsTestDriver.conf --server http://localhost:9876 --tests all --verbose
java.lang.RuntimeException: Connection error on: sun.net.www.protocol.http.HttpURLConnection:http://localhost:9876/jstd/proxy
at com.google.jstestdriver.HttpServer.postJson(HttpServer.java:124)
at com.google.jstestdriver.action.ConfigureProxyAction.run(ConfigureProxyAction.java:56)
at com.google.jstestdriver.ActionRunner.runActions(ActionRunner.java:64)
at com.google.jstestdriver.JsTestDriver.main(JsTestDriver.java:86)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
at java.net.Socket.connect(Socket.java:529)
at java.net.Socket.connect(Socket.java:478)
at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:395)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:530)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:234)
at sun.net.www.http.HttpClient.New(HttpClient.java:307)
at sun.net.www.http.HttpClient.New(HttpClient.java:324)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:970)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:911)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:836)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1014)
at com.google.jstestdriver.HttpServer.postJson(HttpServer.java:116)
... 3 more
Unexpected Runner Condition: Connection error on: sun.net.www.protocol.http.HttpURLConnection:http://localhost:9876/jstd/proxy
 Use --runnerMode DEBUG for more information.

Dan McWeeney

unread,
May 7, 2012, 1:18:19 PM5/7/12
to js-test...@googlegroups.com
Yes, exactly.  If you start a JSTD server on a machine somewhere your build machine can get to then point the maven build to that server it should work.

1.  On server foo.bar.com start JSTD Server:
java -jar JsTestDriver.jar --port 9876
2.  Take one or more browsers and capture them on the server started in Step 1.  Browser to:
3.  Change your JSTD config to point at that foo.bar.com:9876 e.g ( again assuming you are using the JSTD Maven plugin  )
            <plugin>
                <groupId>com.googlecode.jstd-maven-plugin</groupId>
                <artifactId>jstd-maven-plugin</artifactId>
                <version>${jstd.plugin.version}</version>
                <configuration>
                    <server>http://foo.bar.com:9876</server> <!-- usually <server>${jstd.server}</server> --> 

                    <port></port> <!-- usually <port>${jstd.port}</port> -->
                    <basePath>${basedir}</basePath>
                    <config>src-test/resources/jsTestDriver.conf</config>
                    <browser></browser> <!-- usually <browser>${jstd.localBrowser}</browser> -->
                    <testOutput>${basedir}/target/surefire-reports</testOutput>
                </configuration>
                <executions>
                    <execution>
                        <id>run-tests</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

 -d

Tonté Pouncil

unread,
May 7, 2012, 2:46:31 PM5/7/12
to js-test...@googlegroups.com
Okay I will try this and report back to you tomorrow.

But in the mean time, I understand that you say I can't start the JSTD server via the maven build because it will time out after so long.  I know you already said you don't quite remember how many seconds or minutes the JSTD server will wait before it times out?  But is there a way I can configure the time out?  It would be great if I could do it this way because I can just start the JSTD server via the jstd-maven-plugin like normal and then quickly captures two or more remote browsers before it time out.  And then have JSTD server run the test and continue on with the Maven build.

BTW, I am planning on capture remote slave browser by using saucelabs.com

Thank you.

Tonté

Dan McWeeney

unread,
May 7, 2012, 3:07:21 PM5/7/12
to js-test...@googlegroups.com
There are three pieces at play that I think are getting confused:

1.  The JSTD server -- started by:
java -jar JsTestDriver.jar --port 9876
2.  The Browser who will run the tests
3.  The JSTD runner, which processes the test source sends it to the JSTD Server and shows you the results

The server in step 1 is what I am suggesting to just leave running.  If you stop and start the server as part of your CI then the server will be down between builds.  This means that after some period any captured clients (Step 2) are lost and you need to recapture them, which can be a pain.

Just so no one else gets confused --- you can start and stop the server during a build that is what the maven plugin does by default.  All I am saying is that for CI it is one less thing to orchestrate if you leave the server running and clients connected.

hth

-d

Dan McWeeney

unread,
May 7, 2012, 4:58:43 PM5/7/12
to js-test...@googlegroups.com
Also, regarding the total Browser timeout, if you increased the limit on this line


You can make it so it retries for a much longer period.

-d
Reply all
Reply to author
Forward
0 new messages