0 Replies Latest reply on May 9, 2015 9:03 AM by LOH K. H.

    java.lang.NoClassDefFoundError: Lorg/openqa/selenium/firefox/FirefoxDriver

    LOH K. H. Newbie

      I'm using following library in my project:

      • arquillian-junit-container 1.0.3.Final
      • arquillian-protocol-servlet 1.0.3.Final
      • arquillian-drone-selenium 1.1.1.Final
      • selenium-firefox-driver 2.29.0
      • jboss-as-arquillian-container-managed 7.1.3

      When I execute my following junit:

       

      @RunWith(Arquillian.class)
      public class IndexControllerTest {
        @ArquillianResource
        private URL contextPath;
      
        @Drone
        private FirefoxDriver driver;
      
      // @FindBy
        private WebElement lblFirst;
      
        @Deployment(testable=false)
        public static WebArchive createDeployments() {
        WebArchive war = ShrinkWrap.create(WebArchive.class)
                      // add classes
                      .addClasses(IndexControllerTest.class)
                      // add configuration
                      .addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
                      .addAsWebInfResource(new File("src/main/webapp/WEB-INF/beans.xml"))
                      .addAsWebInfResource(new File("src/main/webapp/WEB-INF/faces-config.xml"))
                      // add pages
                      .addAsWebResource(new File("src/main/webapp/index.xhtml"))
                      .setWebXML(new File("src/main/webapp/WEB-INF/web.xml"));
      
              return war;
        }
      
        @Test
        public void login() {
        driver.get(contextPath + "index.xhtml");
      // lblFirst = driver.findElement(By.id("lblFirst"));
      
        Assert.assertNotNull(lblFirst);
        }
      }
      

      I encounter the following error:

      10:18:52,882 INFO  [org.jboss.weld.ClassLoading] (MSC service thread 1-8) catching: org.jboss.weld.resources.spi.ResourceLoadingException: Error loading class org.huahsin.test.IndexControllerTest
        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:152) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:86) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:115) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:171) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:336) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_35]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_35]
        at java.lang.Thread.run(Thread.java:701) [rt.jar:1.6.0_35]
      Caused by: java.lang.NoClassDefFoundError: Lorg/openqa/selenium/firefox/FirefoxDriver;
        at java.lang.Class.getDeclaredFields0(Native Method) [rt.jar:1.6.0_35]
        at java.lang.Class.privateGetDeclaredFields(Class.java:2459) [rt.jar:1.6.0_35]
        at java.lang.Class.getDeclaredFields(Class.java:1808) [rt.jar:1.6.0_35]
        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:102) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflections$4.work(SecureReflections.java:99) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredFields(SecureReflections.java:99) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:153) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:118) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:49) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:40) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)
        at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)
        at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)
        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:149) [weld-core-1.1.5.AS71.Final.jar:2012-02-10 15:31]
        ... 11 more
      Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.firefox.FirefoxDriver from [Module "deployment.d6aa211e-18a4-4a1b-954d-541ac1d9d196.war:main" from Service Module Loader]
        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
        ... 29 more
      

      It seems to me I'm using wrong version of FirefoxDriver. Any clue on this?

       

      }