启动Selenium Server时出错:java.lang.IllegalStateException:不是JSON对象:null

时间:2017-10-12 12:47:58

标签: selenium server

我尝试启动 Seleniun Standalone Server 。我的步骤是:

  1. 已下载selenium-server-standalone-3.6.0.jar
  2. 输入cmd命令java -jar selenium-server-standalone-3.6.0.jar -role hub
  3. 错误:

    java.lang.IllegalStateException: Not a JSON Object: null
    

    如何在没有错误的情况下启动它?

    完整日志:

    C:\>java -jar selenium-server-standalone-3.6.0.jar -role hub
    12:37:57.401 INFO - Selenium build info: version: '3.6.0', revision: 
    '6fbf3ec767'
    12:37:57.401 INFO - Launching Selenium Grid hub
    2017-10-12 12:37:58.197:INFO::main: Logging initialized @975ms to org.seleniumhq.jetty9.util.log.StdErrLog
    12:37:58.211 INFO - Will listen on 4444
    2017-10-12 12:37:58.258:INFO:osjs.Server:main: jetty-9.4.5.v20170502
    2017-10-12 12:37:58.286:INFO:osjs.session:main: DefaultSessionIdManager workerName=node0
    2017-10-12 12:37:58.286:INFO:osjs.session:main: No SessionScavenger set, using defaults
    2017-10-12 12:37:58.289:INFO:osjs.session:main: Scavenging every 600000ms
    2017-10-12 12:37:58.295:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@1ad282e0{/,null,AVAILABLE}
    2017-10-12 12:37:58.308:INFO:osjs.AbstractConnector:main: Started ServerConnector@76ed93a3{HTTP/1.1,[http/1.1]}{0.0.0.0:4444}
    2017-10-12 12:37:58.309:INFO:osjs.Server:main: Started @1087ms
    12:37:58.309 INFO - Nodes should register to http://192.168.56.1:4444/grid/register/
    12:37:58.309 INFO - Selenium Grid hub is up and running
    2017-10-12 12:41:32.842:WARN:osjs.HttpChannel:qtp989938643-13: /grid/register/
    java.lang.IllegalStateException: Not a JSON Object: null
        at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:90)
        at org.openqa.grid.web.servlet.RegistrationServlet.process(RegistrationServlet.java:83)
        at org.openqa.grid.web.servlet.RegistrationServlet.doGet(RegistrationServlet.java:64)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841)
        at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
        at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
        at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473)
        at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1564)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
        at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
        at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.seleniumhq.jetty9.server.Server.handle(Server.java:564)
        at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:317)
        at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251)
        at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
        at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:110)
        at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
        at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:128)
        at org.seleniumhq.jetty9.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
        at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
        at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
        at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
        at java.lang.Thread.run(Unknown Source)
    

1 个答案:

答案 0 :(得分:0)

当我尝试浏览器“ http://x.x.x.x:4444/grid/register/”时,得到的日志与您相同。 尝试浏览器“ http://x.x.x.x:4444/grid/console/”,该网站可用。

所以我认为Selenium Grid集线器已启动并正在运行,我们只是访问了错误的地址。