Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

500 Error, when using /session/:sessionId to retrieve the capabilities of the specified session. #4476

Closed
lukeis opened this issue Mar 4, 2016 · 11 comments

Comments

@lukeis
Copy link
Member

lukeis commented Mar 4, 2016

Originally reported on Google Code with ID 4476

method: Delete and path: /session/:sessionId  works.
method: Post and path: /session workds.

only fail with method: Get, path: /session/:sessionId 

The java log is below:


16:48:55.167 INFO - Executing: [new session: {platform=ANY, javascriptEnabled=true,
browserName=firefox, version=}] at URL: /session)
16:49:10.894 INFO - Done: /session
16:49:10.919 INFO - Executing: org.openqa.selenium.remote.server.handler.GetSessionCapabilities@2c083020
at URL: /session/1346143715521)
16:49:10.919 INFO - Done: /session/1346143715521
16:49:10.927 WARN - Fatal, unhandled exception: /session/1346143715521: java.util.concurrent.ExecutionException:
java.lang.NullPointerException
16:49:10.928 INFO - WebDriver remote server: Fatal, unhandled exception: /session/1346143715521:
org.openqa.selenium.WebDriverException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.1', java.version:
'1.6.0_33'
Driver info: driver.version: unknown
16:49:10.931 WARN - EXCEPTION 
javax.servlet.ServletException: org.openqa.selenium.WebDriverException: java.util.concurrent.ExecutionException:
java.lang.NullPointerException
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.1', java.version:
'1.6.0_33'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:206)
    at org.openqa.selenium.remote.server.DriverServlet.doGet(DriverServlet.java:158)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:139)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
    at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: org.openqa.selenium.WebDriverException: java.util.concurrent.ExecutionException:
java.lang.NullPointerException
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.1', java.version:
'1.6.0_33'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:197)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
    ... 16 more
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:157)
    at org.openqa.selenium.remote.server.handler.WebDriverHandler.execute(WebDriverHandler.java:89)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:238)
    at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:190)
    ... 17 more
Caused by: java.lang.NullPointerException
    at org.openqa.selenium.remote.server.JeeServletHttpRequest.forward(JeeServletHttpRequest.java:73)
    at org.openqa.selenium.remote.server.renderer.ForwardResult.render(ForwardResult.java:35)
    at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:231)
    at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:150)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)
16:49:10.935 ERROR - /wd/hub/session/1346143715521: 
org.openqa.selenium.WebDriverException: java.util.concurrent.ExecutionException: java.lang.NullPointerException
Build info: version: '2.25.0', revision: '17482', time: '2012-07-18 21:08:56'
System info: os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.8.1', java.version:
'1.6.0_33'
Driver info: driver.version: unknown
    at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:197)
    at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
    at org.openqa.selenium.remote.server.DriverServlet.doGet(DriverServlet.java:158)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:139)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677)
    at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
    at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
    at org.openqa.jetty.http.HttpServer.service(HttpServer.java:914)
    at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
    at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
    at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
    at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
Caused by: java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:157)
    at org.openqa.selenium.remote.server.handler.WebDriverHandler.execute(WebDriverHandler.java:89)
    at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:238)
    at org.openqa.selenium.remote.server.JsonHttpRemoteConfig.handleRequest(JsonHttpRemoteConfig.java:190)
    ... 17 more
Caused by: java.lang.NullPointerException
    at org.openqa.selenium.remote.server.JeeServletHttpRequest.forward(JeeServletHttpRequest.java:73)
    at org.openqa.selenium.remote.server.renderer.ForwardResult.render(ForwardResult.java:35)
    at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:231)
    at org.openqa.selenium.remote.server.rest.ResultConfig$1.call(ResultConfig.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:150)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:680)

Reported by ni184775761 on 2012-08-28 08:53:18

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2012-09-11 09:15:59

  • Labels added: Component-WebDriver

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Please show your code, which command do you execute that causes this failure?

Reported by barancev on 2012-10-12 07:03:38

  • Status changed: NeedsClarification

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Closing the issue as there is no responce from the author for long time.

Reported by barancev on 2012-11-04 21:46:43

  • Labels removed: Status-Untriaged

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by barancev on 2012-11-04 21:47:01

  • Status changed: Invalid

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I am receiving this error using the same version and revision number for selenium-server-standalone-2.25.0.jar
in both Windows 7 and Mac OS X.  To repeat this error, I start the jar on the command-line,
then access it from RESTClient in a Firefox browser.  I added the "Content-type:application-json;charset=UTF-8"
header as directed in the JSON Wire Protocol documentation, and then send a POST request
to http://localhost:4444/wd/hub/session with body: <pre>{"desiredCapabilities":{"browserName":"firefox"}}</pre>
.  A Firefox browser opens on the client machine, and the sessionID gets set, but the
response to the RESTClient utility is error code 500.

Reported by rrahkola on 2012-12-06 18:51:53

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Forget the "<pre>" tags on the above comment.  The body was entirely a JSON-formatted
string.

Reported by rrahkola on 2012-12-06 18:53:04

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Okay, since I'm a newbie at this, this was fixed by adding the other required header:
Accept:application-json;charset=UTF-8 .  I confirmed this worked with all browsers
I tried: chrome and internet explorer.

In summary, here is an acceptable RESTClient request:
Method: POST
URL: http://localhost:4444/wd/hub/session
Headers:
Content-Type:application/json;charset=UTF-8
Accept:application/json;charset=UTF-8
Body:
{desiredCapabilities:{browserName:"firefox"}}

"firefox" can be replaced with "chrome" and "internet explorer".

P.S.  I also paste below my command-line for the selenium webdriver server:
java -jar selenium-server-2.25.0.jar -Dwebdriver.chrome.driver=.\chromedriver.exe -Dwebdriver.ie.driver=.\IEDriverServer.exe

P.P.S.  When I tried Internet Explorer, I first received an error mentioning that Protected
Mode (an IE option) needs to be the same for all domains, either enabled or disabled.
 I made sure the Protected Mode checkbox was checked for all domains and the next REST
command was successful.

Reported by rrahkola on 2012-12-06 19:57:35

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

OK, changing the verdict to WorkingAsIntended.

And I'm interested why do you need to send requests directly? Are you goig to to implement
a new client for some language?

Reported by barancev on 2012-12-06 20:10:21

  • Status changed: WorkingAsIntended

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Thanks @rrahk...@gmail.com it works! And sorry for not reply this issue for so long...
BTW @barancev,I am just implementing a nodeJS binding

Reported by ni184775761 on 2012-12-07 03:10:47

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

I'm learning to use php-wrapper, which provides a very basic object-based implementation
of the WebDriver RESTful web service requests.  I was testing the selenium-server application
to debug my environment.  On a side note I am also developing a pageObject base class
in PHP for our regression tests.

Reported by rrahkola on 2012-12-09 02:52:15

@lukeis
Copy link
Member Author

lukeis commented Mar 4, 2016

Reported by luke.semerau on 2015-09-17 18:16:02

  • Labels added: Restrict-AddIssueComment-Commit

@lukeis lukeis closed this as completed Mar 4, 2016
@SeleniumHQ SeleniumHQ locked and limited conversation to collaborators Mar 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant