• Post Reply Bookmark Topic Watch Topic
  • New Topic

html Unit errors  RSS feed

 
Willie Tsang
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No matter what i run i keep getting Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/xni/XNIException
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createHtmlPage(DefaultPageCreator.java:221)
at com.gargoylesoftware.htmlunit.DefaultPageCreator.createPage(DefaultPageCreator.java:106)
at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseInto(WebClient.java:433)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:311)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:373)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:358)
at homeWorks.LoginTester.main(LoginTester.java:11)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.xni.XNIException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
erros... with eclipose. I have downloaded htmlunit,junit, testNG and also i added it the jars of htmlunit and the libraries of junit and testNg, but same erros.
Thanks in advance for any help.
 
Paul Clapham
Sheriff
Posts: 22835
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a link to a page which lists the "dependencies" of the HtmlUnit project: Project Dependencies.

In the case of the stacktrace you posted, it looks like HtmlUnit needs to have the Xerces jar in the classpath. If I read that page right, it looks like you need all of the jars described in the first table, the ones which are "required to compile and run the application". You might also need jars mentioned in the "Transitive Dependencies" section of that page, but I'm not sure of that. However if you continue to have class-not-found errors after you fix up your classpath, that section is probably the place to look to see what other jars you need.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!