From: Bill T. <wat...@al...> - 2014-08-01 23:46:04
|
The error is: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.cookie.BrowserCompatSpecFactory.create(Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/cookie/CookieSpec; at com.gargoylesoftware.htmlunit.CookieManager.<init>(CookieManager.java:54) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:136) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:199) at asst.htmlUnit.RenderJavaScriptMain.main(RenderJavaScriptMain.java:21) Line 21 of my main program is: WebClient webClient = new WebClient(); I have had a lot of trouble instantiating a WebClient because of Class Not Found errors. I ended up downloading several extra .jar files to get the program to get this far. The .jar files I am using are: batik-ext-1.6-1.jar commons-codec-1.9.jar commons-collections-3.2.1.jar commons-io-2.4.jar commons-lang3-3.3.2.jar commons-logging-1.1.3.jar cssparser-0.9.14.jar htmlunit-2.15.jar htmlunit-core-js-2.15.jar httpclient-4.3.3.jar httpcore-4.3.jar httpmime-4.3.3.jar jetty-websocket-8.1.15.v20140411.jar nekohtml-1.9.21.jar xalan-2.7.1.jar xercesImpl-2.11.0.jar xml-apis-1.4.01.jar I am running in Eclipse Version: Kepler Service Release 2 Build id: 20140224-0627 The JDK is 1.7. Thanks for your input. Bill Taylor |
From: Ahmed A. <asa...@ya...> - 2014-08-02 05:12:13
|
Hi, This is a classpath issue. You may have different/incompatible HttpClient library version(s). You can use maven, which automatically handles all dependencies, or use only the jars with HtmlUnit distribution. Ahmed ________________________________ From: Bill Taylor <wat...@al...> To: htm...@li... Sent: Saturday, August 2, 2014 1:16 AM Subject: [Htmlunit-user] I am getting a No Such Method error when I call new WebClient(); The error is: Exception in thread "main" java.lang.NoSuchMethodError: org.apache.http.impl.cookie.BrowserCompatSpecFactory.create(Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/cookie/CookieSpec; at com.gargoylesoftware.htmlunit.CookieManager.<init>(CookieManager.java:54) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:136) at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:199) at asst.htmlUnit.RenderJavaScriptMain.main(RenderJavaScriptMain.java:21) Line 21 of my main program is: WebClient webClient = new WebClient(); I have had a lot of trouble instantiating a WebClient because of Class Not Found errors. I ended up downloading several extra .jar files to get the program to get this far. The .jar files I am using are: batik-ext-1.6-1.jar commons-codec-1.9.jar commons-collections-3.2.1.jar commons-io-2.4.jar commons-lang3-3.3.2.jar commons-logging-1.1.3.jar cssparser-0.9.14.jar htmlunit-2.15.jar htmlunit-core-js-2.15.jar httpclient-4.3.3.jar httpcore-4.3.jar httpmime-4.3.3.jar jetty-websocket-8.1.15.v20140411.jar nekohtml-1.9.21.jar xalan-2.7.1.jar xercesImpl-2.11.0.jar xml-apis-1.4.01.jar I am running in Eclipse Version: Kepler Service Release 2 Build id: 20140224-0627 The JDK is 1.7. Thanks for your input. Bill Taylor ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Htmlunit-user mailing list Htm...@li... https://lists.sourceforge.net/lists/listinfo/htmlunit-user |
From: Marc G. <mgu...@ya...> - 2014-08-14 15:00:43
|
Hi, this is surely a classpath issue. In your list, httpcore-4.3.jar doesn't look correct. You can download HtmlUnit with all it's dependencies or use for instance Maven to be sure to have the right versions of the different libraries. Cheers, Marc. -- HtmlUnit support & consulting from the source Blog: http://mguillem.wordpress.com Le 02/08/2014 01:16, Bill Taylor a écrit : > The error is: > > Exception in thread "main" java.lang.NoSuchMethodError: > org.apache.http.impl.cookie.BrowserCompatSpecFactory.create(Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/cookie/CookieSpec; > at com.gargoylesoftware.htmlunit.CookieManager.<init>(CookieManager.java:54) > at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:136) > at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:199) > at asst.htmlUnit.RenderJavaScriptMain.main(RenderJavaScriptMain.java:21) > > Line 21 of my main program is: > > WebClient webClient = new WebClient(); > > I have had a lot of trouble instantiating a WebClient because of Class > Not Found errors. I ended up downloading several extra .jar files to > get the program to get this far. The .jar files I am using are: > > batik-ext-1.6-1.jar > commons-codec-1.9.jar > commons-collections-3.2.1.jar > commons-io-2.4.jar > commons-lang3-3.3.2.jar > commons-logging-1.1.3.jar > cssparser-0.9.14.jar > htmlunit-2.15.jar > htmlunit-core-js-2.15.jar > httpclient-4.3.3.jar > httpcore-4.3.jar > httpmime-4.3.3.jar > jetty-websocket-8.1.15.v20140411.jar > nekohtml-1.9.21.jar > xalan-2.7.1.jar > xercesImpl-2.11.0.jar > xml-apis-1.4.01.jar > > I am running in Eclipse Version: Kepler Service Release 2 > Build id: 20140224-0627 > > The JDK is 1.7. > > Thanks for your input. > > Bill Taylor |
From: Ashutosh S. <ash...@gm...> - 2014-08-14 15:34:32
|
Please refer to my earlier post. If you are running your code within a mananged environment(like IBM WAS, Oracle Weblogic or JBoss etc...) - you will encounter this issue. As all these managed container has pre-packaged apache httpClient.jar already and at the runt time - Class loader will load and try to use the apache httpClient.jar that came with the container and not your bundled one. We encountered this issue in IBM WAS8.x and used the parent classloading in WAS Admin console to fix this issue. Parent class loading will make sure that the apache httpclient.jar that is part of your implementation(under WEB-INF/lib) is being loaded before the WAS's apache httpclient.jar file. Hope this helps. On Thu, Aug 14, 2014 at 9:53 AM, Marc Guillemot <mgu...@ya...> wrote: > Hi, > > this is surely a classpath issue. In your list, httpcore-4.3.jar doesn't > look correct. You can download HtmlUnit with all it's dependencies or > use for instance Maven to be sure to have the right versions of the > different libraries. > > Cheers, > Marc. > -- > HtmlUnit support & consulting from the source > Blog: http://mguillem.wordpress.com > > Le 02/08/2014 01:16, Bill Taylor a écrit : > > The error is: > > > > Exception in thread "main" java.lang.NoSuchMethodError: > > > org.apache.http.impl.cookie.BrowserCompatSpecFactory.create(Lorg/apache/http/protocol/HttpContext;)Lorg/apache/http/cookie/CookieSpec; > > at > com.gargoylesoftware.htmlunit.CookieManager.<init>(CookieManager.java:54) > > at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:136) > > at com.gargoylesoftware.htmlunit.WebClient.<init>(WebClient.java:199) > > at asst.htmlUnit.RenderJavaScriptMain.main(RenderJavaScriptMain.java:21) > > > > Line 21 of my main program is: > > > > WebClient webClient = new WebClient(); > > > > I have had a lot of trouble instantiating a WebClient because of Class > > Not Found errors. I ended up downloading several extra .jar files to > > get the program to get this far. The .jar files I am using are: > > > > batik-ext-1.6-1.jar > > commons-codec-1.9.jar > > commons-collections-3.2.1.jar > > commons-io-2.4.jar > > commons-lang3-3.3.2.jar > > commons-logging-1.1.3.jar > > cssparser-0.9.14.jar > > htmlunit-2.15.jar > > htmlunit-core-js-2.15.jar > > httpclient-4.3.3.jar > > httpcore-4.3.jar > > httpmime-4.3.3.jar > > jetty-websocket-8.1.15.v20140411.jar > > nekohtml-1.9.21.jar > > xalan-2.7.1.jar > > xercesImpl-2.11.0.jar > > xml-apis-1.4.01.jar > > > > I am running in Eclipse Version: Kepler Service Release 2 > > Build id: 20140224-0627 > > > > The JDK is 1.7. > > > > Thanks for your input. > > > > Bill Taylor > > > > ------------------------------------------------------------------------------ > _______________________________________________ > Htmlunit-user mailing list > Htm...@li... > https://lists.sourceforge.net/lists/listinfo/htmlunit-user > -- With best Regards: Ashutosh Sharma |