Search code examples
javaintellij-ideagroovygeb

Geb NoClassDefFoundError: geb/error/UnableToLoadException


I've ben having trouble setting up and testing Geb. I have a simple Groovy script:

import geb.Browser;

println("Test 11")

Browser.drive {
    go "http://www.google.com"
}

and I always get the following error:

Caught: java.lang.NoClassDefFoundError: geb/error/UnableToLoadException
java.lang.NoClassDefFoundError: geb/error/UnableToLoadException
    at geb.Browser.<init>(Browser.groovy:61)
    at geb.Browser.drive(Browser.groovy:1028)
    at geb.Browser$drive.call(Unknown Source)
    at Main.run(Main.groovy:8)

I wrote a Class.forName("geb.error.UnableToLoadException") which changed the error to

java.lang.NoClassDefFoundError: geb/error/GebException
    at Main.run(Main.groovy:10)
Caused by: java.lang.ClassNotFoundException: geb.error.GebException
    ... 1 more

It seems to me that Geb is searching for a class GebException, which is not inside the geb-core-2.1.jar I've downloaded! Next to this jar, I also added the selenium-server-standalone-3.9.1.jar. Am I doing something wrong? Did I install some wrong geb-core library? I am using IntelliJ IDEA as the IDE. Thank you for your help

Best regards


Solution

  • If this is a maven project where yourfile is in, I suggest to check your dependency list in pom.xml first.

    As I tested in my env, it is executing perfectly