[webdriver] Question about RemoteWebDriverServer

44 views
Skip to first unread message

Nilesh

unread,
Jun 3, 2011, 10:49:06 AM6/3/11
to webdriver
I am fairly new to RemoteWebDriverServer, Jetty and Servlet. Sorry if
this sounds really basic. I am using 2.0b2, jetty 6.1.22,jetty-
util-6.1.22. I am trying to configure the selenium server in the code
so that I can avoid the manual process of starting the selenium
server on the remote host. Here is what I have so far, basically copy
of the code from the RemoteWebDriverServer wiki [1]. When I start the
server locally, I get following message.

2011-06-03 10:30:55.312:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
2011-06-03 10:30:55.343:INFO::jetty-6.1.22
2011-06-03 10:30:55.577:INFO::NO JSP Support for , did not find
org.apache.jasper.servlet.JspServlet
2011-06-03 10:30:55.827:INFO::Started
SelectChann...@0.0.0.0:4444

If I set the remote host like below, I get bind exception.
public AppServer() throws Exception {
try {
WebAppContext context = new WebAppContext();
context.setContextPath("");
context.setWar(".");
server.addHandler(context);
context.addServlet(DriverServlet.class, "/wd/*");
SelectChannelConnector connector = new SelectChannelConnector();
connector.setHost("MyRemoteHostIPAddress");
connector.setPort(4444);
server.addConnector(connector);
server.start();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static void main(String[] args) throws Exception{
new AppServer();
}
}

2011-06-03 10:32:26.747:WARN::failed
SelectChannelConnector@MyRemoteHostIPAddress:4444:
java.net.BindException: Cannot assign requested address: bind

So I thought the port might not be open or some other app may be using
this port. So I ran the above code "locally" on the "remote host" and
then ran my webdriver test on my "local machine" then I get following
exception. I did try different port numbers here but no success. If I
start the selenium server manually on the remote hosts, the webdriver
test on my local system works just fine.

java.lang.UnsupportedOperationException:
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:
131)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:
105)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:
410)
at
org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:
104)
at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:
87)
at
org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:
95)

Is there anything I am missing or doing incorrectly?

Thanks,
-Nilesh
[1]http://code.google.com/p/selenium/wiki/RemoteWebDriverServer

Nilesh

unread,
Jun 3, 2011, 2:52:34 PM6/3/11
to webdriver
Am I missing the WAR file in the code above? RemoteWebDriverServer
wiki mentions to download "webdriver-remote-server.zip". Could someone
point me to its location? Perhaps I can find the WAR file in there?

Thanks,
-Nilesh

On Jun 3, 10:49 am, Nilesh <nilesh.c...@gmail.com> wrote:
> I am fairly new to RemoteWebDriverServer, Jetty and Servlet. Sorry if
> this sounds really basic. I am using 2.0b2, jetty 6.1.22,jetty-
> util-6.1.22. I am trying to configure the selenium server in the code
> so that I can avoid the manual process of starting the selenium
> server on the remote host. Here is what I have so far, basically copy
> of the code from the RemoteWebDriverServer wiki [1]. When I start the
> server locally, I get following message.
>
> 2011-06-03 10:30:55.312:INFO::Logging to STDERR via
> org.mortbay.log.StdErrLog
> 2011-06-03 10:30:55.343:INFO::jetty-6.1.22
> 2011-06-03 10:30:55.577:INFO::NO JSP Support for , did not find
> org.apache.jasper.servlet.JspServlet
> 2011-06-03 10:30:55.827:INFO::Started
> SelectChannelConnec...@0.0.0.0:4444

Nilesh

unread,
Jun 3, 2011, 4:10:07 PM6/3/11
to webdriver
Please disregard the second Exception I posted earlier, I fixed that.
It turned out to be a bug in my code. So when I run start the jetty
server through code "locally" on the "remote" host, I was actually
connecting from my local machine to URL http://remoteServer:remotePort/wd/hub
instead of http://remoteServer:remotePort/wd. After this change test
works fine.

The only issue that I have now is- how to start the server "remotely"
from my "local" machine. Following still seems to be a problem.
Anyone?

connector.setHost("MyRemoteHostIPAddress");
connector.setPort(3002);

2011-06-03 16:06:08.376:INFO::Logging to STDERR via
org.mortbay.log.StdErrLog
2011-06-03 16:06:08.392:INFO::jetty-6.1.22
2011-06-03 16:06:08.735:WARN::failed
SelectChannelConnector@MyRemoteHostIPAddress:3002:
java.net.BindException: Cannot assign requested address: bind
2011-06-03 16:06:08.735:WARN::failed Server@ef5502:
java.net.BindException: Cannot assign requested address: bind
Exception in thread "main" java.net.BindException: Cannot assign
requested address: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at
org.mortbay.jetty.nio.SelectChannelConnector.open(SelectChannelConnector.java:
216)
at
org.mortbay.jetty.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:
315)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at org.mortbay.jetty.Server.doStart(Server.java:235)
at
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:
50)
at AppServer.main(AppServer.java:28)
Reply all
Reply to author
Forward
0 new messages