{"action":"created","issue":{"url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/22","repository_url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver","labels_url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/22/comments","events_url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/22/events","html_url":"https://github.com/SeleniumHQ/htmlunit-driver/issues/22","id":173573396,"number":22,"title":"java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/api/Session","user":{"login":"itsgoodtobebad","id":11895230,"avatar_url":"https://avatars.githubusercontent.com/u/11895230?v=3","gravatar_id":"","url":"https://api.github.com/users/itsgoodtobebad","html_url":"https://github.com/itsgoodtobebad","followers_url":"https://api.github.com/users/itsgoodtobebad/followers","following_url":"https://api.github.com/users/itsgoodtobebad/following{/other_user}","gists_url":"https://api.github.com/users/itsgoodtobebad/gists{/gist_id}","starred_url":"https://api.github.com/users/itsgoodtobebad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsgoodtobebad/subscriptions","organizations_url":"https://api.github.com/users/itsgoodtobebad/orgs","repos_url":"https://api.github.com/users/itsgoodtobebad/repos","events_url":"https://api.github.com/users/itsgoodtobebad/events{/privacy}","received_events_url":"https://api.github.com/users/itsgoodtobebad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-08-27T02:38:52Z","updated_at":"2016-10-11T22:59:50Z","closed_at":null,"body":"My code is very simple:\r\n\r\n    public class HtmlUnitDriverTest {\r\n        public static void main(String[] args) {\r\n            final WebClient webClient = new WebClient();\r\n        }\r\n    }\r\n\r\nWhen use htmlunit-driver 2.20, it's ok.\r\nBut when i update to 2.23, i meet the following error:\r\n\r\nException in thread \"main\" java.lang.NoClassDefFoundError: org/eclipse/jetty/websocket/api/Session\r\n\tat java.lang.Class.getDeclaredMethods0(Native Method)\r\n\tat java.lang.Class.privateGetDeclaredMethods(Class.java:2625)\r\n\tat java.lang.Class.getDeclaredMethods(Class.java:1868)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.process(AbstractJavaScriptConfiguration.java:197)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.getClassConfiguration(AbstractJavaScriptConfiguration.java:172)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.buildUsageMap(AbstractJavaScriptConfiguration.java:79)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration.<init>(AbstractJavaScriptConfiguration.java:59)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.<init>(JavaScriptConfiguration.java:597)\r\n\tat com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration.getInstance(JavaScriptConfiguration.java:613)\r\n\tat com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.<init>(JavaScriptEngine.java:133)\r\n\tat com.gargoylesoftware.htmlunit.WebClient.init(WebClient.java:239)\r\n\tat com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:213)\r\n\tat com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:204)\r\n\tat HtmlUnitDriverTest.main(HtmlUnitDriverTest.java:11)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n\tat sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)\r\n\tat sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n\tat java.lang.reflect.Method.invoke(Method.java:606)\r\n\tat com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)\r\nCaused by: java.lang.ClassNotFoundException: org.eclipse.jetty.websocket.api.Session\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:366)\r\n\tat java.net.URLClassLoader$1.run(URLClassLoader.java:355)\r\n\tat java.security.AccessController.doPrivileged(Native Method)\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:354)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:425)\r\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:358)\r\n\t... 19 more\r\n\r\nI compare my pom.xml file of 2.20 and 2.23, \r\nmy 2.20 pom:\r\n\r\n    <dependency>\r\n        <groupId>net.sourceforge.htmlunit</groupId>\r\n        <artifactId>htmlunit</artifactId>\r\n        <version>2.20</version>\r\n    </dependency>\r\n\r\nthe 2.23 pom:\r\n\r\n    <dependency>\r\n        <groupId>net.sourceforge.htmlunit</groupId>\r\n        <artifactId>htmlunit</artifactId>\r\n        <version>2.23</version>\r\n        <exclusions>\r\n            <exclusion>\r\n                <groupId>org.eclipse.jetty.websocket</groupId>\r\n                <artifactId>websocket-client</artifactId>\r\n            </exclusion>\r\n        </exclusions>\r\n    </dependency>\r\n\r\nDo I need to manually add the dependency for jetty? \r\nPlease help me, thanks a lot."},"comment":{"url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/comments/253072090","html_url":"https://github.com/SeleniumHQ/htmlunit-driver/issues/22#issuecomment-253072090","issue_url":"https://api.github.com/repos/SeleniumHQ/htmlunit-driver/issues/22","id":253072090,"user":{"login":"ThrawnCA","id":3080440,"avatar_url":"https://avatars.githubusercontent.com/u/3080440?v=3","gravatar_id":"","url":"https://api.github.com/users/ThrawnCA","html_url":"https://github.com/ThrawnCA","followers_url":"https://api.github.com/users/ThrawnCA/followers","following_url":"https://api.github.com/users/ThrawnCA/following{/other_user}","gists_url":"https://api.github.com/users/ThrawnCA/gists{/gist_id}","starred_url":"https://api.github.com/users/ThrawnCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThrawnCA/subscriptions","organizations_url":"https://api.github.com/users/ThrawnCA/orgs","repos_url":"https://api.github.com/users/ThrawnCA/repos","events_url":"https://api.github.com/users/ThrawnCA/events{/privacy}","received_events_url":"https://api.github.com/users/ThrawnCA/received_events","type":"User","site_admin":false},"created_at":"2016-10-11T22:59:50Z","updated_at":"2016-10-11T22:59:50Z","body":"I think I've found it!\r\n\r\nYou haven't specified the `BrowserVersion` that your WebClient will emulate, so it defaults to the best-supported version - which is currently Chrome. And when your WebClient initialises its JavaScript support, the configuration class (`com.gargoylesoftware.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration`, if you're wondering) will trawl the annotations on all known JavaScript objects (the list is in `com.gargoylesoftware.htmlunit.javascript.configuration.JavaScriptConfiguration`) to check whether they support the selected `BrowserVersion`. And `WebSocket` uses the `JsxClass` annotation with default values - which support Chrome.\r\n\r\nSo yes, you probably should add the `websocket-client` dependency. I assume that it was dropped so that clients using a different browser version don't have to include it - although since the *default* is to rely on it, I'd call that a poor choice. If someone really doesn't want that JAR, they can specifically exclude it themselves."}}
{"actor":{"display_login":"ThrawnCA"}}