2

I have been trying to run a simple cucumber test. But it gives me the following errors:

Exception in thread "main" java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at cucumber.runtime.Reflections.hasConstructor(Reflections.java:51)
    at cucumber.runtime.Reflections.instantiateSubclasses(Reflections.java:28)
    at cucumber.runtime.Runtime.loadBackends(Runtime.java:96)
    at cucumber.runtime.Runtime.<init>(Runtime.java:63)
    at cucumber.api.cli.Main.run(Main.java:24)
    at cucumber.api.cli.Main.main(Main.java:16)
Caused by: java.lang.ClassNotFoundException: cucumber.io.ResourceLoader
    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)
    ... 10 more

My test looks like this. I think a jar file is missing. Not familiar with cucumber setup

Feature: AddUser
In order to perform operations on the library system
I want to be able to add a valid user.

Scenario: Add unique user
Given I have entered a username Ali
And I have entered a password 22
And I have entered a given name ali
And I have entered a family name abbas
And I have entered a middle Initial F
And I have entered a email ali@gmail.com
And I have entered a roleID Member
When I press Create User
Then a new user should be added
user2885431
  • 37
  • 1
  • 4
  • Duplicate of http://stackoverflow.com/questions/25291480/cucumber-exception-java-lang-classnotfoundexception-cucumber-io-resourceloader? You're missing the cucumber-core library. How are you managing your classpath? – Romski Nov 13 '14 at 05:11
  • If you think a jar file is missing, which jar files are present in your classpath? – Dude Apr 14 '15 at 14:28

1 Answers1

3

It looks like you're missing the cucumber-core library.

Try adding the following to your dependencies.

https://mvnrepository.com/artifact/info.cukes/cucumber-core/1.2.5

 <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>1.2.5</version>
    </dependency>
vaibhavcool20
  • 861
  • 3
  • 11
  • 28