Htmlunit / Webclient / Wildfly10 error

Asked

Viewed 160 times

1

I’m trying to use the htmlunit but it’s happening:

*** Environment/Server: WildFly10

When executing the following command:

WebClient webClient = new WebClient(BrowserVersion.FIREFOX_45);

The mistake happens:

17:34:19,139 WARN  [org.jboss.modules] (default task-4) Failed to define class com.gargoylesoftware.htmlunit.html.DomElement in Module "deployment.teste.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/gargoylesoftware/htmlunit/html/DomElement (Module "deployment.teste.war:main" from Service Module Loader): org/w3c/dom/ElementTraversal
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:78)
at org.jboss.modules.Module.loadModuleClass(Module.java:605)
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:358)
at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:437)
   .
   .
   .
Caused by: javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: Failed to link com/gargoylesoftware/htmlunit/html/BaseFrameElement (Module "deployment.teste.war:main" from Service Module Loader): Failed to link com/gargoylesoftware/htmlunit/html/HtmlElement (Module "deployment..war:main" from Service Module Loader): Failed to link com/gargoylesoftware/htmlunit/html/DomElement (Module "deployment.sigeap.war:main" from Service Module Loader): org/w3c/dom/ElementTraversal
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:101)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 50 more  
   .
   .
   .
17:34:19,168 ERROR [io.undertow.request] (default task-4) UT005023: Exception handling request to /teste/pages/teste/teste.jsf: javax.servlet.ServletException: java.lang.NoClassDefFoundError: Failed to link com/gargoylesoftware/htmlunit/html/BaseFrameElement (Module "deployment.teste.war:main" from Service Module Loader): Failed to link  

Maven:

<dependency>     
     <groupId>net.sourceforge.htmlunit</groupId>     
     <artifactId>htmlunit</artifactId>            
     <version>2.23</version> 
</dependency>
  • I couldn’t read it all, but the mistake seems to be in using the javax.faces

  • I decided to withdraw from the Maven and adding the .jar directly on the project.

1 answer

1


It was with the same problem, but I decided to put a version compatible with my project. I discovered that some libraries of my project were clashing with Htmlunit. When I modified the Htmlunit version that contained the same dependencies of my project everything worked correctly.

Httpclient-4.2.1 (used in my project) was in conflict with Htmlunit-2.21 (which uses httpclient-4.5.2.jar). Then I switched to Htmlunit 2.10 version (which uses Httpclient-4.2.1) and everything worked correctly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.