sterodium / selenium-grid-extensions

Set of Selenium Grid extensions for a better UI tests.
Apache License 2.0
46 stars 23 forks source link

"MIME type may not contain reserved characters" error #55

Closed braindonor closed 6 years ago

braindonor commented 7 years ago

Hi,

I've been running the grid extensions on Selenium 2.53.0 for some time now with no problems. I'm testing an upgrade to Selenium 3.4 and am seeing the attached error being thrown. Selenium 3.4 is working fine up until the point I use the grid extensions in my test.

Any pointers to help debug and resolve this issue would be greatly appreciated.

Thanks,

Pentti

15:52:33.478 INFO - Creating POST request to forward 2017-06-22 15:52:33.479:WARN:osjs.HttpChannel:qtp28654916-13: /grid/admin/HubRequestsProxyingServlet/session/926f6d9e-e31c-43dc-89fe-81a8ad0e46dd/SikuliExtensionServlet/target-factory java.lang.IllegalArgumentException: MIME type may not contain reserved characters at org.apache.http.util.Args.check(Args.java:36) at org.apache.http.entity.ContentType.create(ContentType.java:206) at org.apache.http.entity.ContentType.create(ContentType.java:218) at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75) at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56) at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46) at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70) at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 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:543) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481) at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130) 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:320) 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:112) at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:122) at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58) at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201) at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133) 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(Thread.java:745)

braindonor commented 7 years ago

After some hours trying to debug this, I've got it working, but it's a bit of a hack. Maybe it will help someone find a proper solution though.

Class RequestForwardingClient method createPostRequest was amended as follows:

private HttpRequestBase createPostRequest(HttpServletRequest request) throws IOException { HttpPost httpPost = new HttpPost();

    String mimeType = "application/octet-stream";    

    InputStreamEntity entity = new InputStreamEntity(request.getInputStream(),
            request.getContentLength(),
            ContentType.create(mimeType));
    httpPost.setEntity(entity);

    return httpPost;
}
sjethvani commented 7 years ago

I see , I had seen bit of similar issue today when building whole selenium-grid-extension project by 'mvn clean install' command . Some tests under 'HubRequestsProxyingServletTest.java' were failing because of MIME can't be null . While debugging I came to know that request.getContentType() was sent as 'null' & because of this those tests were failing . I fixed them under PR 56

Now regarding your issue , I doubt you may also be getting 'request.getContentType()' as null & If this is the case then you can modify your code as follows (IMHO)

String mimeType = (request.getContentType()!=null) ? request.getContentType() : "application/octet-stream";
InputStreamEntity entity = new InputStreamEntity(request.getInputStream(),
        request.getContentLength(),
        ContentType.create(mimeType));
httpPost.setEntity(entity);
return httpPost;

}
braindonor commented 7 years ago

Thanks for your reply. I tested your suggested change and I'm still getting the failure. I added a log.info to display the mime type:

10:13:19.689 INFO - Content type: text/plain; charset=ISO-8859-1

Appears to fail the validation because the mime type contains a semi-colon.

hemano commented 7 years ago

I'm also facing the same error on MAC OS Sierra Webdriver 3.4.0

/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=55837:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/lib/tools.jar:/Users/hemantojha/JavaProjects/noah_branches/SukuliRemoteBySterodium/target/classes:/Users/hemantojha/.m2/repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar:/Users/hemantojha/.m2/repository/commons-logging/commons-logging/1.2/commons-logging-1.2.jar:/Users/hemantojha/.m2/repository/com/github/virtuald/curvesapi/1.04/curvesapi-1.04.jar:/Users/hemantojha/.m2/repository/org/hamcrest/hamcrest-all/1.3/hamcrest-all-1.3.jar:/Users/hemantojha/.m2/repository/org/apache/poi/poi/3.15/poi-3.15.jar:/Users/hemantojha/.m2/repository/commons-codec/commons-codec/1.10/commons-codec-1.10.jar:/Users/hemantojha/.m2/repository/org/apache/poi/poi-excelant/3.15/poi-excelant-3.15.jar:/Users/hemantojha/.m2/repository/org/apache/ant/ant/1.8.2/ant-1.8.2.jar:/Users/hemantojha/.m2/repository/org/apache/ant/ant-launcher/1.8.2/ant-launcher-1.8.2.jar:/Users/hemantojha/.m2/repository/org/apache/poi/poi-ooxml/3.15/poi-ooxml-3.15.jar:/Users/hemantojha/.m2/repository/org/apache/poi/poi-ooxml-schemas/3.15-beta1/poi-ooxml-schemas-3.15-beta1.jar:/Users/hemantojha/.m2/repository/org/apache/poi/poi-scratchpad/3.15/poi-scratchpad-3.15.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-java/3.4.0/selenium-java-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-api/3.4.0/selenium-api-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-chrome-driver/3.4.0/selenium-chrome-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-edge-driver/3.4.0/selenium-edge-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-firefox-driver/3.4.0/selenium-firefox-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-ie-driver/3.4.0/selenium-ie-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-opera-driver/3.4.0/selenium-opera-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-remote-driver/3.4.0/selenium-remote-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-safari-driver/3.4.0/selenium-safari-driver-3.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/selenium-support/3.4.0/selenium-support-3.4.0.jar:/Users/hemantojha/.m2/repository/cglib/cglib-nodep/3.2.4/cglib-nodep-3.2.4.jar:/Users/hemantojha/.m2/repository/org/apache/commons/commons-exec/1.3/commons-exec-1.3.jar:/Users/hemantojha/.m2/repository/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar:/Users/hemantojha/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar:/Users/hemantojha/.m2/repository/org/w3c/css/sac/1.3/sac-1.3.jar:/Users/hemantojha/.m2/repository/net/sourceforge/cssparser/cssparser/0.9.22/cssparser-0.9.22.jar:/Users/hemantojha/.m2/repository/com/google/code/gson/gson/2.8.0/gson-2.8.0.jar:/Users/hemantojha/.m2/repository/com/google/guava/guava/21.0/guava-21.0.jar:/Users/hemantojha/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar:/Users/hemantojha/.m2/repository/net/sourceforge/htmlunit/htmlunit/2.26/htmlunit-2.26.jar:/Users/hemantojha/.m2/repository/net/sourceforge/htmlunit/htmlunit-core-js/2.26/htmlunit-core-js-2.26.jar:/Users/hemantojha/.m2/repository/net/sourceforge/htmlunit/neko-htmlunit/2.25/neko-htmlunit-2.25.jar:/Users/hemantojha/.m2/repository/org/apache/httpcomponents/httpclient/4.5.3/httpclient-4.5.3.jar:/Users/hemantojha/.m2/repository/org/apache/httpcomponents/httpcore/4.4.6/httpcore-4.4.6.jar:/Users/hemantojha/.m2/repository/org/apache/httpcomponents/httpmime/4.5.3/httpmime-4.5.3.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/jetty-io/9.4.1.v20170120/jetty-io-9.4.1.v20170120.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/jetty-util/9.4.1.v20170120/jetty-util-9.4.1.v20170120.jar:/Users/hemantojha/.m2/repository/net/java/dev/jna/jna/4.1.0/jna-4.1.0.jar:/Users/hemantojha/.m2/repository/net/java/dev/jna/jna-platform/4.1.0/jna-platform-4.1.0.jar:/Users/hemantojha/.m2/repository/junit/junit/4.12/junit-4.12.jar:/Users/hemantojha/.m2/repository/com/codeborne/phantomjsdriver/1.4.0/phantomjsdriver-1.4.0.jar:/Users/hemantojha/.m2/repository/org/seleniumhq/selenium/htmlunit-driver/2.26/htmlunit-driver-2.26.jar:/Users/hemantojha/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/websocket/websocket-api/9.4.3.v20170317/websocket-api-9.4.3.v20170317.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/websocket/websocket-client/9.4.3.v20170317/websocket-client-9.4.3.v20170317.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/jetty-client/9.4.3.v20170317/jetty-client-9.4.3.v20170317.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/jetty-http/9.4.3.v20170317/jetty-http-9.4.3.v20170317.jar:/Users/hemantojha/.m2/repository/org/eclipse/jetty/websocket/websocket-common/9.4.3.v20170317/websocket-common-9.4.3.v20170317.jar:/Users/hemantojha/.m2/repository/xalan/serializer/2.7.2/serializer-2.7.2.jar:/Users/hemantojha/.m2/repository/xalan/xalan/2.7.2/xalan-2.7.2.jar:/Users/hemantojha/.m2/repository/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar:/Users/hemantojha/.m2/repository/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar:/Users/hemantojha/.m2/repository/org/springframework/spring-beans/4.3.7.RELEASE/spring-beans-4.3.7.RELEASE.jar:/Users/hemantojha/.m2/repository/org/springframework/spring-context/4.3.7.RELEASE/spring-context-4.3.7.RELEASE.jar:/Users/hemantojha/.m2/repository/org/springframework/spring-aop/4.3.7.RELEASE/spring-aop-4.3.7.RELEASE.jar:/Users/hemantojha/.m2/repository/org/springframework/spring-core/4.3.7.RELEASE/spring-core-4.3.7.RELEASE.jar:/Users/hemantojha/.m2/repository/org/springframework/spring-expression/4.3.7.RELEASE/spring-expression-4.3.7.RELEASE.jar:/Users/hemantojha/.m2/repository/org/apache/xmlbeans/xmlbeans/2.6.0/xmlbeans-2.6.0.jar:/Users/hemantojha/.m2/repository/stax/stax-api/1.0.1/stax-api-1.0.1.jar:/Users/hemantojha/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/Users/hemantojha/.m2/repository/com/aventstack/extentreports/3.0.5/extentreports-3.0.5.jar:/Users/hemantojha/.m2/repository/org/freemarker/freemarker/2.3.23/freemarker-2.3.23.jar:/Users/hemantojha/.m2/repository/org/mongodb/mongodb-driver/3.3.0/mongodb-driver-3.3.0.jar:/Users/hemantojha/.m2/repository/org/mongodb/bson/3.3.0/bson-3.3.0.jar:/Users/hemantojha/.m2/repository/org/mongodb/mongodb-driver-core/3.3.0/mongodb-driver-core-3.3.0.jar:/Users/hemantojha/.m2/repository/org/jsoup/jsoup/1.9.2/jsoup-1.9.2.jar:/Users/hemantojha/.m2/repository/ch/qos/logback/logback-classic/1.1.7/logback-classic-1.1.7.jar:/Users/hemantojha/.m2/repository/ch/qos/logback/logback-core/1.1.7/logback-core-1.1.7.jar:/Users/hemantojha/.m2/repository/org/slf4j/slf4j-api/1.7.20/slf4j-api-1.7.20.jar:/Users/hemantojha/.m2/repository/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar:/Users/hemantojha/.m2/repository/DataGen/DataManagementUtil/2.5.1/DataManagementUtil-2.5.1.jar:/Users/hemantojha/.m2/repository/com/saucelabs/saucerest/1.0.32/saucerest-1.0.32.jar:/Users/hemantojha/.m2/repository/org/json/json/20090211/json-20090211.jar:/Users/hemantojha/.m2/repository/com/saucelabs/sauce_java_common/2.1.8/sauce_java_common-2.1.8.jar:/Users/hemantojha/.m2/repository/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar:/Users/hemantojha/.m2/repository/commons-lang/commons-lang/2.6/commons-lang-2.6.jar:/Users/hemantojha/.m2/repository/com/sikulix/sikulixapi/1.1.2-SNAPSHOT/sikulixapi-1.1.2-20170726.080654-34.jar:/Users/hemantojha/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar:/Users/hemantojha/.m2/repository/commons-net/commons-net/3.4/commons-net-3.4.jar:/Users/hemantojha/.m2/repository/com/melloware/jintellitype/1.3.7/jintellitype-1.3.7.jar:/Users/hemantojha/.m2/repository/com/nativelibs4java/bridj/0.7.0/bridj-0.7.0.jar:/Users/hemantojha/.m2/repository/com/google/android/tools/dx/1.7/dx-1.7.jar:/Users/hemantojha/.m2/repository/com/github/vidstige/jadb/-v1.0-g94ebf38-23/jadb--v1.0-g94ebf38-23.jar:/Users/hemantojha/.m2/repository/com/sikulix/sikulixlibsmac/1.1.2-SNAPSHOT/sikulixlibsmac-1.1.2-20170726.080602-34.jar:/Users/hemantojha/.m2/repository/com/sikulix/sikulix2tigervnc/2.0.0-SNAPSHOT/sikulix2tigervnc-2.0.0-20170517.105900-14.jar:/Users/hemantojha/.m2/repository/ru/yandex/qatools/ashot/ashot/1.5.4/ashot-1.5.4.jar:/Users/hemantojha/.m2/repository/org/apache/maven/maven-plugin-api/3.3.9/maven-plugin-api-3.3.9.jar:/Users/hemantojha/.m2/repository/org/apache/maven/maven-model/3.3.9/maven-model-3.3.9.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar:/Users/hemantojha/.m2/repository/org/apache/maven/maven-artifact/3.3.9/maven-artifact-3.3.9.jar:/Users/hemantojha/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.plexus/0.3.2/org.eclipse.sisu.plexus-0.3.2.jar:/Users/hemantojha/.m2/repository/javax/enterprise/cdi-api/1.0/cdi-api-1.0.jar:/Users/hemantojha/.m2/repository/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar:/Users/hemantojha/.m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar:/Users/hemantojha/.m2/repository/org/eclipse/sisu/org.eclipse.sisu.inject/0.3.2/org.eclipse.sisu.inject-0.3.2.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.5.2/plexus-classworlds-2.5.2.jar:/Users/hemantojha/.m2/repository/com/saucelabs/sauce-connect/3.1.32/sauce-connect-3.1.32.jar:/Users/hemantojha/.m2/repository/com/saucelabs/ci-sauce/1.123/ci-sauce-1.123.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-archiver/3.4/plexus-archiver-3.4.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-io/2.7.1/plexus-io-2.7.1.jar:/Users/hemantojha/.m2/repository/org/apache/commons/commons-compress/1.11/commons-compress-1.11.jar:/Users/hemantojha/.m2/repository/org/iq80/snappy/snappy/0.4/snappy-0.4.jar:/Users/hemantojha/.m2/repository/org/tukaani/xz/1.5/xz-1.5.jar:/Users/hemantojha/.m2/repository/com/saucelabs/sebuilder-interpreter/1.0.6/sebuilder-interpreter-1.0.6.jar:/Users/hemantojha/.m2/repository/net/sf/opencsv/opencsv/2.3/opencsv-2.3.jar:/Users/hemantojha/.m2/repository/com/google/code/findbugs/jsr305/3.0.1/jsr305-3.0.1.jar:/Users/hemantojha/.m2/repository/org/codehaus/plexus/plexus-container-default/1.5.5/plexus-container-default-1.5.5.jar:/Users/hemantojha/.m2/repository/org/apache/xbean/xbean-reflect/3.4/xbean-reflect-3.4.jar:/Users/hemantojha/.m2/repository/commons-logging/commons-logging-api/1.1/commons-logging-api-1.1.jar:/Users/hemantojha/.m2/repository/com/google/collections/google-collections/1.0/google-collections-1.0.jar:/Users/hemantojha/.m2/repository/io/sterodium/sikuli-extension-client/0.4-SNAPSHOT/sikuli-extension-client-0.4-20151015.221544-2.jar:/Users/hemantojha/.m2/repository/io/sterodium/sikuli-extension/0.4-SNAPSHOT/sikuli-extension-0.4-20151015.221540-2.jar:/Users/hemantojha/.m2/repository/org/sikuli/sikuli-api/1.2.0/sikuli-api-1.2.0.jar:/Users/hemantojha/.m2/repository/org/sikuli/sikuli-core/1.2.2/sikuli-core-1.2.2.jar:/Users/hemantojha/.m2/repository/org/piccolo2d/piccolo2d-extras/1.3.1/piccolo2d-extras-1.3.1.jar:/Users/hemantojha/.m2/repository/org/piccolo2d/piccolo2d-core/1.3.1/piccolo2d-core-1.3.1.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp/0.10/javacpp-0.10.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10-linux-x86.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10-linux-x86_64.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10-windows-x86_64.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10-windows-x86.jar:/Users/hemantojha/.m2/repository/org/bytedeco/javacpp-presets/opencv/2.4.10-0.10/opencv-2.4.10-0.10-macosx-x86_64.jar:/Users/hemantojha/.m2/repository/io/sterodium/sterodium-rmi/0.1/sterodium-rmi-0.1.jar:/Users/hemantojha/.m2/repository/org/objenesis/objenesis/2.1/objenesis-2.1.jar:/Users/hemantojha/.m2/repository/cglib/cglib/3.1/cglib-3.1.jar:/Users/hemantojha/.m2/repository/org/ow2/asm/asm/4.2/asm-4.2.jar:/Users/hemantojha/.m2/repository/io/sterodium/file-extension-client/0.4-SNAPSHOT/file-extension-client-0.4-20151015.221535-2.jar:/Users/hemantojha/.m2/repository/org/zeroturnaround/zt-zip/1.8/zt-zip-1.8.jar com.apolloglobal.testing.api.client.tbd objc[29674]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java (0x103fc24c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x1058194e0). One of the two will be used. Which one is undefined. Jul 27, 2017 5:54:37 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS 17:54:41.509 [main] DEBUG io.sterodium.extensions.client.upload.ResourceUploadRequest - Uploading resources from path:newImages 17:54:41.515 [main] DEBUG io.sterodium.extensions.client.upload.ResourceFolder - Zipping resource folder newImages 17:54:41.516 [main] DEBUG io.sterodium.extensions.client.upload.ResourceFolder - Created temporary zip at /var/folders/bl/fr6nn8sj7y3_4pjmhtnx6f1m0000gn/T/resources_4987277279489223542.zip 17:54:41.516 [main] DEBUG io.sterodium.extensions.client.upload.ResourceFolder - Resource protocol is file 17:54:41.530 [main] DEBUG org.zeroturnaround.zip.ZipUtil - Compressing '/Users/hemantojha/JavaProjects/noah_branches/SukuliRemoteBySterodium/target/classes/newImages' into '/var/folders/bl/fr6nn8sj7y3_4pjmhtnx6f1m0000gn/T/resources_4987277279489223542.zip'. 17:54:41.561 [main] DEBUG io.sterodium.extensions.client.SikuliExtensionClient - Resource bundle uploaded to <!DOCTYPE html>

Selenium  v.

Whoops! The URL specified routes to this help page.

For more information about Selenium please see the docs and/or visit the wiki. Or perhaps you are looking for the Selenium console.

Happy Testing!

Selenium is made possible through the efforts of our open source community, contributions from these people, and our sponsors.

17:54:41.689 [main] INFO io.sterodium.rmi.protocol.client.RestClient - Invocation request: {"method":"setImagePrefix","arguments":["\u003c!DOCTYPE html\u003e\n\u003chtml lang\u003d\"en\"\u003e\n\u003chead\u003e\n \u003cmeta charset\u003d\"UTF-8\"\u003e\n \u003clink rel\u003d\"stylesheet\" type\u003d\"text/css\" href\u003d\"/assets/displayhelpservlet.css\" media\u003d\"all\"/\u003e\n \u003clink href\u003d\"/assets/favicon.ico\" rel\u003d\"icon\" type\u003d\"image/x-icon\" /\u003e\n \u003cscript src\u003d\"/assets/jquery-3.1.1.min.js\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e\n \u003cscript src\u003d\"/assets/displayhelpservlet.js\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e\n \u003cscript type\u003d\"text/javascript\"\u003e\n var json \u003d Object.freeze(\u0027{\"version\":\"3.4.0\",\"type\":\"Grid Node\",\"consoleLink\":\"/wd/hub\"}\u0027);\n \u003c/script\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\n\u003cdiv id\u003d\"content\"\u003e\n \u003cdiv id\u003d\"help-heading\"\u003e\n \u003ch1\u003e\u003cspan id\u003d\"logo\"\u003e\u003c/span\u003e\u003c/h1\u003e\n \u003ch2\u003eSelenium \u003cspan class\u003d\"se-type\"\u003e\u003c/span\u003e\u0026nbsp;v.\u003cspan class\u003d\"se-version\"\u003e\u003c/span\u003e\u003c/h2\u003e\n \u003c/div\u003e\n\n \u003cdiv id\u003d\"content-body\"\u003e\n \u003cp\u003e\n Whoops! The URL specified routes to this help page.\n \u003c/p\u003e\n \u003cp\u003e\n For more information about Selenium \u003cspan class\u003d\"se-type\"\u003e\u003c/span\u003e please see the\n \u003ca class\u003d\"se-docs\"\u003edocs\u003c/a\u003e and/or visit the \u003ca class\u003d\"se-wiki\"\u003ewiki\u003c/a\u003e.\n \u003cspan id\u003d\"console-item\"\u003e\n Or perhaps you are looking for the Selenium \u003cspan class\u003d\"se-type\"\u003e\u003c/span\u003e \u003ca class\u003d\"se-console\"\u003econsole\u003c/a\u003e.\n \u003c/span\u003e\n \u003c/p\u003e\n \u003cp\u003e\n Happy Testing!\n \u003c/p\u003e\n \u003c/div\u003e\n\n \u003cdiv\u003e\n \u003cfooter id\u003d\"help-footer\"\u003e\n Selenium is made possible through the efforts of our open source community, contributions from\n these \u003ca href\u003d\"https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS\"\u003epeople\u003c/a\u003e, and our\n \u003ca href\u003d\"http://www.seleniumhq.org/sponsors/\"\u003esponsors\u003c/a\u003e.\n \u003c/footer\u003e\n \u003c/div\u003e\n \u003c/div\u003e\n\n\u003c/body\u003e\n\u003c/html\u003e"],"argumentClasses":["java.lang.String"]} 17:54:41.703 [main] ERROR io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor - Unmapped response java.lang.RuntimeException: Widget target-factory invocation failed (expected 200, but was 500):

Error 500 Server Error

HTTP ERROR 500

Problem accessing /grid/admin/HubRequestsProxyingServlet/session/15fec52e-b055-4cb7-a826-a07d92cc7a17/SikuliExtensionServlet/target-factory. Reason:

    Server Error

Caused by:

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:206)
    at org.apache.http.entity.ContentType.create(ContentType.java:218)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    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:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    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:320)
    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:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    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(Thread.java:745)

Powered by Jetty:// 9.4.3.v20170317

at io.sterodium.rmi.protocol.client.RestClient.invoke(RestClient.java:66)
at io.sterodium.rmi.protocol.client.RemoteInvoker.invoke(RemoteInvoker.java:36)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.invoke(RemoteObjectMethodInterceptor.java:58)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.intercept(RemoteObjectMethodInterceptor.java:40)
at io.sterodium.extensions.node.rmi.TargetFactory$$EnhancerByCGLIB$$5f79a28d.setImagePrefix(<generated>)
at io.sterodium.extensions.client.SikuliExtensionClient.uploadResourceBundle(SikuliExtensionClient.java:57)
at com.apolloglobal.testing.api.client.tbd.main(tbd.java:48)

17:54:41.704 [main] INFO io.sterodium.rmi.protocol.client.RestClient - Invocation request: {"method":"createImageTarget","arguments":["google_sign_in.png"],"argumentClasses":["java.lang.String"]} 17:54:41.713 [main] ERROR io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor - Unmapped response java.lang.RuntimeException: Widget target-factory invocation failed (expected 200, but was 500):

Error 500 Server Error

HTTP ERROR 500

Problem accessing /grid/admin/HubRequestsProxyingServlet/session/15fec52e-b055-4cb7-a826-a07d92cc7a17/SikuliExtensionServlet/target-factory. Reason:

    Server Error

Caused by:

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:206)
    at org.apache.http.entity.ContentType.create(ContentType.java:218)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    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:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    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:320)
    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:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    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(Thread.java:745)

Powered by Jetty:// 9.4.3.v20170317

at io.sterodium.rmi.protocol.client.RestClient.invoke(RestClient.java:66)
at io.sterodium.rmi.protocol.client.RemoteInvoker.invoke(RemoteInvoker.java:36)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.invoke(RemoteObjectMethodInterceptor.java:58)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.intercept(RemoteObjectMethodInterceptor.java:40)
at io.sterodium.extensions.node.rmi.TargetFactory$$EnhancerByCGLIB$$5f79a28d.createImageTarget(<generated>)
at com.apolloglobal.testing.api.client.tbd.main(tbd.java:51)

17:54:41.791 [main] INFO io.sterodium.rmi.protocol.client.RestClient - Invocation request: {"method":"find","arguments":["null"],"argumentClasses":["org.sikuli.api.Target"]} 17:54:41.814 [main] ERROR io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor - Unmapped response java.lang.RuntimeException: Widget desktop invocation failed (expected 200, but was 500):

Error 500 Server Error

HTTP ERROR 500

Problem accessing /grid/admin/HubRequestsProxyingServlet/session/15fec52e-b055-4cb7-a826-a07d92cc7a17/SikuliExtensionServlet/desktop. Reason:

    Server Error

Caused by:

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:206)
    at org.apache.http.entity.ContentType.create(ContentType.java:218)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    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:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    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:320)
    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:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:122)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
    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(Thread.java:745)

Powered by Jetty:// 9.4.3.v20170317

at io.sterodium.rmi.protocol.client.RestClient.invoke(RestClient.java:66)
at io.sterodium.rmi.protocol.client.RemoteInvoker.invoke(RemoteInvoker.java:36)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.invoke(RemoteObjectMethodInterceptor.java:58)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.intercept(RemoteObjectMethodInterceptor.java:40)
at org.sikuli.api.DesktopScreenRegion$$EnhancerByCGLIB$$5a433733.find(<generated>)
at com.apolloglobal.testing.api.client.tbd.main(tbd.java:54)

Process finished with exit code 0

sjethvani commented 7 years ago

I doubt on request headers being sent ... Please make sure that request headers being sent are proper or not . Few months back , when I checked out this project (it was not updated to selenium 3.0 at that time) , I was still getting some error in uploading file to node or (I don't remember now what was exact problem) , However I had to change basic 'createPostRequest' method of 'RequestForwardingClient' class , after which it started working fine .

Here is changed method . See if it helps any of you ...

What I changed I set header for 'filePath' attribute & its value

private HttpRequestBase createPostRequest(HttpServletRequest request) throws IOException {
    HttpPost httpPost = new HttpPost();
    InputStreamEntity entity = new InputStreamEntity(request.getInputStream(),
            request.getContentLength(),
            ContentType.create(request.getContentType()));

    Enumeration headerNames = request.getHeaderNames();
    while (headerNames!=null && headerNames.hasMoreElements())
    {
        Object nextElement = headerNames.nextElement();
        LOGGER.info("(createPostRequest)HEADER IS "+nextElement);
        LOGGER.info("(createPostRequest)HEADERValue IS "+request.getHeader(nextElement.toString()));
        this line ---->if(nextElement!=null && nextElement.toString().equals("filePath"))
        this line ---->httpPost.setHeader(nextElement.toString(), request.getHeader(nextElement.toString()));
    }

    httpPost.setEntity(entity);
    return httpPost;
}

PS : If above doesn't help you , then analyze your http request calls and check what is missing

helena121 commented 7 years ago

Hello,

I have the same problem on Centos 7, with Selenium 3.4.0 and also after downgrading to Selenium 2.53.0.

With Selenium 3.4.0:

io.sterodium.rmi.protocol.server.TargetServerException: Widget target-factory invocation failed (expected 200, but was 500):

Error 500 Server Error

HTTP ERROR 500

Problem accessing /grid/admin/HubRequestsProxyingServlet/session/be47fd01-7323-4909-88c7-7b3a2a709ddd/SikuliExtensionServlet/target-factory. Reason:

    Server Error

Caused by:

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:206)
    at org.apache.http.entity.ContentType.create(ContentType.java:218)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    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:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    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:320)
    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:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    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(Thread.java:748)

Powered by Jetty:// 9.4.3.v20170317

at io.sterodium.rmi.protocol.client.RestTransport.send(RestTransport.java:49)
at io.sterodium.rmi.protocol.client.RestClient.invoke(RestClient.java:40)
at io.sterodium.rmi.protocol.client.RemoteInvoker.invoke(RemoteInvoker.java:36)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.invoke(RemoteObjectMethodInterceptor.java:69)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.intercept(RemoteObjectMethodInterceptor.java:51)
at io.sterodium.extensions.node.rmi.TargetFactory$$EnhancerByCGLIB$$5f79a28d.setImagePrefix(<generated>)
at io.sterodium.extensions.client.SikuliExtensionClient.uploadResourceBundle(SikuliExtensionClient.java:57)
at io.sterodium.sample.test.AceEditorTest.inputFunctionToAceEditor(AceEditorTest.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

With Selenium 2.53.0:

io.sterodium.rmi.protocol.server.TargetServerException: Widget target-factory invocation failed (expected 200, but was 500):

Error 500 Server Error

HTTP ERROR 500

Problem accessing /grid/admin/HubRequestsProxyingServlet/session/0e4f0561-6bb1-41ff-9d08-02a7302f5e5a/SikuliExtensionServlet/target-factory. Reason:

    Server Error

Caused by:

java.lang.IllegalArgumentException: MIME type may not contain reserved characters
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.entity.ContentType.create(ContentType.java:206)
    at org.apache.http.entity.ContentType.create(ContentType.java:218)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createPostRequest(RequestForwardingClient.java:75)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.createHttpRequest(RequestForwardingClient.java:56)
    at io.sterodium.extensions.hub.proxy.client.RequestForwardingClient.forwardRequest(RequestForwardingClient.java:46)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.forwardRequest(HubRequestsProxyingServlet.java:70)
    at io.sterodium.extensions.hub.proxy.HubRequestsProxyingServlet.doPost(HubRequestsProxyingServlet.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    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:543)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doHandle(SessionHandler.java:1584)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1228)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
    at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:481)
    at org.seleniumhq.jetty9.server.session.SessionHandler.doScope(SessionHandler.java:1553)
    at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
    at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1130)
    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:320)
    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:112)
    at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:122)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecutingExecutionStrategy.invoke(ExecutingExecutionStrategy.java:58)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:201)
    at org.seleniumhq.jetty9.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:133)
    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(Thread.java:748)

Powered by Jetty:// 9.4.3.v20170317

at io.sterodium.rmi.protocol.client.RestTransport.send(RestTransport.java:49)
at io.sterodium.rmi.protocol.client.RestClient.invoke(RestClient.java:40)
at io.sterodium.rmi.protocol.client.RemoteInvoker.invoke(RemoteInvoker.java:36)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.invoke(RemoteObjectMethodInterceptor.java:69)
at io.sterodium.rmi.protocol.client.RemoteObjectMethodInterceptor.intercept(RemoteObjectMethodInterceptor.java:51)
at io.sterodium.extensions.node.rmi.TargetFactory$$EnhancerByCGLIB$$810169a7.setImagePrefix(<generated>)
at io.sterodium.extensions.client.SikuliExtensionClient.uploadResourceBundle(SikuliExtensionClient.java:57)
at io.sterodium.sample.test.AceEditorTest.inputFunctionToAceEditor(AceEditorTest.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

No suggested solution worked for me. Thank you for any help.

shankarkc commented 7 years ago

I think I too hit this issue. This is the defect i opened. https://github.com/sterodium/selenium-grid-extensions/issues/59 After looking at the call stack I think these two defects might be same. So I am adding a reference here.

@echoAlexey Can you please help us here? I even tried debug. But debugger shows

Unable to insert breakpoint Absent Line Number Information

for the class in question. So i couldnt debug it. Really appreciate your help here.

echoAlexey commented 7 years ago

Hi @shankarkc , I don't have capacity to support this project at the moment. Sorry :(

shankarkc commented 7 years ago

I debugged further and found below pointers if someone can help...In meantime I will continue to debug... request.entity value is

[Content-Type: text/plain; charset=ISO-8859-1,Content-Length: 103,Chunked: false]

It was posting to

POST /grid/admin/HubRequestsProxyingServlet/session/c36bc53c1274ff5c5ccbeb2bbe3793f2/SikuliExtensionServlet/target-factory HTTP/1.1

In sterodium-rmi-master\src\main\java\io\sterodium\rmi\protocol\client\RestTransport.java it throws error here as it received 500 status code

        int statusCode = getStatusCode(httpResponse);
        if (statusCode == HttpStatus.SC_NOT_FOUND) {
            throw new TargetObjectNotFoundException(format("Widget %s is not available at %s", objectId, getUrl(request)));
        } else if (statusCode != HttpStatus.SC_OK) {
            String messageFromServer = EntityUtils.toString(httpResponse.getEntity());
            String message = "Widget %s invocation failed (expected 200, but was %s): %s";
            throw new TargetServerException(format(message, objectId, statusCode, messageFromServer));
        }

Thanks Shankar KC

shankarkc commented 7 years ago

I have a workaround now I modified selenium-grid-extensions\hub-extensions\extension-proxy\src\main\java\io\sterodium\extensions\hub\proxy\client\RequestForwardingClient.java and striped the encoding and now with my local binaries its working. Its a hack though. I am not sure where this encoding is getting appended to header contentType section. Once I find it out I will create a pull request that solves this issue.

    private HttpRequestBase createPostRequest(HttpServletRequest request) throws IOException {
        HttpPost httpPost = new HttpPost();
        InputStreamEntity entity = new InputStreamEntity(request.getInputStream(),
                request.getContentLength(),
                // some requests contain ContentType;Encoding and fails in validation. 
                //Ex value that fail is:- plaintext; UTF-8
                // So striping Encoding and retaining only ContentType
                ContentType.create((request.getContentType().split(";")[0])));
        httpPost.setEntity(entity);

        return httpPost;
    }

If you are blocked by this bug use above code and build a binary from the source(after patching source code)

shankarkc commented 7 years ago

I have a fix for this... https://github.com/sterodium/selenium-grid-extensions/pull/60 Thanks Shankar KC

braindonor commented 6 years ago

Thanks. I've now updated to v1.0, and my hack is no longer required.