Saturday, May 23, 2015

Arquillian is looking for com/opera/core/systems/OperaDriver

On last week when I was unit testing with Arquillian, I got this error causing my unit test failed.
java.lang.NoClassDefFoundError: com/opera/core/systems/OperaDriver
 at java.lang.Class.getDeclaredMethods0(Native Method)
 at java.lang.Class.privateGetDeclaredMethods(Class.java:2575)
 at java.lang.Class.getDeclaredMethods(Class.java:1857)
 at org.jboss.arquillian.core.impl.Reflections.getObserverMethods(Reflections.java:52)
 at org.jboss.arquillian.core.impl.ExtensionImpl.of(ExtensionImpl.java:51)
 at org.jboss.arquillian.core.impl.ManagerImpl.inject(ManagerImpl.java:198)
 at org.jboss.arquillian.core.impl.InjectorImpl.inject(InjectorImpl.java:58)
 at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.createServiceInstance(ServiceRegistryLoader.java:108)
 at org.jboss.arquillian.core.impl.loadable.ServiceRegistryLoader.all(ServiceRegistryLoader.java:55)
 at org.jboss.arquillian.drone.impl.DroneRegistrar.registerConfigurators(DroneRegistrar.java:84)
 at org.jboss.arquillian.drone.impl.DroneRegistrar.register(DroneRegistrar.java:77)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
 at org.jboss.arquillian.test.impl.TestContextHandler.createSuiteContext(TestContextHandler.java:60)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:622)
 at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
 at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:88)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
 at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
 at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.beforeSuite(EventTestRunnerAdaptor.java:68)
 at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:97)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.ClassNotFoundException: com.opera.core.systems.OperaDriver
 at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
 ... 35 more
While spotting the error on the Maven configuration, I found out that grahene-webdriver and arquillian-drone-webdriver were both declare in POM.
        <dependency>
         <groupid>org.jboss.arquillian.graphene</groupid>
         <artifactid>graphene-webdriver</artifactid>
         <version>2.0.0.Alpha1</version>
         <type>pom</type>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.graphene</groupid>
         <artifactid>graphene-webdriver-drone</artifactid>
         <version>2.0.0.Alpha3</version>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver</artifactid>
         <scope>test</scope>
        </dependency>
        
        <dependency>
         <groupid>org.jboss.arquillian.extension</groupid>
         <artifactid>arquillian-drone-webdriver-depchain</artifactid>
         <type>pom</type>
         <scope>test</scope>
        </dependency>
Why both web driver were declare? That was my first question come into my mind. Is that necessary? Is there any difference? As according to the Arquillian guide, I'm suppose to have graphene-webdriver with version 2.0.3.Final. And the other 3 dependencies are not needed. This has my problem resolved.

No comments: