Re: [Cucumber] cucumber/io/ResourceLoader

1,583 views
Skip to first unread message

aslak hellesoy

unread,
Mar 13, 2013, 5:22:22 AM3/13/13
to Cucumber Users



On Wed, Mar 13, 2013 at 8:47 AM, mahesh tanneeru <tanneer...@gmail.com> wrote:
Hi i am new to cucumber, when i tried to run test file i am getting below error,
 
can any one help please...
 

Don't mix cucumber-* versions. You have 1.1.2 and 1.0.1
Use JUnit 4.11

Aslak
 
 
 
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

org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)

at

org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)

at

org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

at

org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)

at

org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)

at

org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)

at

org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:33)

at

org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:25)

at

org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:48)

at

org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:38)

at

org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)

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: 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)

... 18 more
 
 
and here is my POM file.
 
 
 
 
 
 

<

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>cucumber.com</groupId>

<artifactId>cucumber1</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>test231</name>

<description>abc123</description>

<dependencies>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-ooxml</artifactId>

<version>3.8</version>

</

dependency>

<

dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-java</artifactId>

<version>1.0.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-junit</artifactId>

<version>1.0.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-java</artifactId>

<version>2.24.1</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-server</artifactId>

<version>2.13.0</version>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>3.8.1</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-ie-driver</artifactId>

<version>2.24.1</version>

</dependency>

<dependency>

<groupId>org.openqa.selenium.server</groupId>

<artifactId>selenium-server</artifactId>

<version>1.0-20081010.060147</version>

</dependency>

<dependency>

<groupId>org.testng</groupId>

<artifactId>testng</artifactId>

<version>6.5.2</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-firefox-driver</artifactId>

<version>2.24.1</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-rc</artifactId>

<version>1.0.2</version>

<type>pom</type>

</dependency>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi</artifactId>

<version>3.8</version>

</dependency>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-ooxml-schemas</artifactId>

<version>3.8</version>

</dependency>

<!-- LOG4J - BASIC LOGGING CAPABILITIES -->

<dependency>

<groupId>log4j</groupId>

<artifactId>log4j</artifactId>

<version>1.2.16</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-jvm</artifactId>

<version>1.1.2</version>

<type>pom</type>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-core</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-groovy</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-guice</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>de.saumya.mojo</groupId>

<artifactId>cucumber-maven-plugin</artifactId>

<version>1.0.0-beta</version>

<type>maven-plugin</type>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-html</artifactId>

<version>0.2.2</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.cucumber</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-picocontainer</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>net.masterthought</groupId>

<artifactId>cucumber-reporting</artifactId>

<version>0.0.17</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad</artifactId>

<version>2.2</version>

<type>pom</type>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.core</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.dojo</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.html</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.jquery</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>com.daveayan</groupId>

<artifactId>gherkinsalad.tinymce</artifactId>

<version>2.2</version>

</dependency>

<dependency>

<groupId>com.google.code.maven-play-plugin</groupId>

<artifactId>play-selenium-junit4</artifactId>

<version>1.0.0-beta4</version>

</dependency>

</dependencies>

<build>

<testResources>

<!-- FRAMEWORK PROPERTY FILE -->

<testResource>

<directory>src/main/resources</directory>

<filtering>true</filtering>

<includes>

<include>**/*.properties</include>

</includes>

</testResource>

<!-- DATASHEET LOCATION -->

<testResource>

<directory>src/test/resources/datasheets/*</directory>

</testResource>

</testResources>

<plugins>

<!-- MAVEN COMPILER PLUGIN -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<source>1.6</source>

<target>1.6</target>

<fork>true</fork>

</configuration>

</plugin>

<!-- MAVEN SUREFIRE PLUGIN -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-surefire-plugin</artifactId>

<version>2.10</version>

<configuration>

<!-- INCLUDE ALL TEST SCRIPT FILES -->

<includes>

<include>**/*.java</include>

</includes>

<!-- PASS FRAMEWORK PROPERTIES FOR USE BY SUREFIRE -->

<systemProperties>

<property>

<name>test_phase</name>

<value>${test_phase}</value>

</property>

<property>

<name>test_environment</name>

<value>${test_environment}</value>

</property>

<property>

<name>debug_switch</name>

<value>${debug_switch}</value>

</property>

</systemProperties>

</configuration>

</plugin>

</plugins>

</build>

</

project>

 
 
 
thanks in advance
 
 

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].
2) Please use interleaved answers http://en.wikipedia.org/wiki/Posting_style#Interleaved_style
3) If you have a question, don't reply to an existing message. Start a new topic instead.
 
You received this message because you are subscribed to the Google Groups Cukes group. To post to this group, send email to cu...@googlegroups.com. To unsubscribe from this group, send email to cukes+un...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/cukes?hl=en
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

mahesh tanneeru

unread,
Mar 13, 2013, 8:19:08 AM3/13/13
to cu...@googlegroups.com

On Wednesday, March 13, 2013 9:22:22 AM UTC, Aslak Hellesøy wrote:

hi Aslak,
thanks for your reply, i did the changes you mentioned but stll the result is same.
 
thanks in advance
 
here is the changed POM file
 
 

<

project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>cucumber.com</groupId>

<artifactId>cucumber1</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>test231</name>

<description>abc123</description>

<dependencies>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-ooxml</artifactId>

<version>3.8</version>

</

dependency>

<

dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-java</artifactId>

<version>1.1.2</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-junit</artifactId>

<version>1.1.2</version>

<scope>test</scope>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-java</artifactId>

<version>2.24.1</version>

</dependency>

<dependency>

<groupId>org.seleniumhq.selenium</groupId>

<artifactId>selenium-server</artifactId>

<version>2.13.0</version>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.11</version>

project>

 

 


 
 
java.lang.NoClassDefFoundError: cucumber/io/ResourceLoader

at java.lang.Class

<font co

...

aslak hellesoy

unread,
Mar 13, 2013, 8:28:31 AM3/13/13
to Cucumber Users
On Wed, Mar 13, 2013 at 12:19 PM, mahesh tanneeru <tanneer...@gmail.com> wrote:

On Wednesday, March 13, 2013 9:22:22 AM UTC, Aslak Hellesøy wrote:

hi Aslak,
thanks for your reply, i did the changes you mentioned but stll the result is same.
 

The cucumber.io.ResourceLoader class doesn't exist (and isn't referenced anywhere) in cucumber-jvm 1.1.2. (It did exist in older versions).
Seeing this error message therefore means that you still have classes on your classpath that refererence cucumber.io.ResourceLoader.
This would most likely be an older version of cucumber-jvm that you claim to have removed. Perhaps you have other jars in your pom that depend on older cucumber-jvm versions?

Try `mvn dependency:tree` to find out.

Your classpath is definitely messed up.

Aslak
 

--

mahesh tanneeru

unread,
Mar 13, 2013, 9:38:59 AM3/13/13
to cu...@googlegroups.com
thanx aslak,
i observed my project in detail and its all messed up.
 
i created another new project with all dependiences (same version) this time i am gitting different error
 

java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/InvokerInvocationException

 
and i added only one 'groovy' dependiency, below is the POM file
 
 

<groupId>test.com</groupId>

<artifactId>cucumber2</artifactId>

<version>0.0.1-SNAPSHOT</version>

<name>test6</name>

<description>test7</description>

<dependencies>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-core</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-groovy</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-html</artifactId>

<version>0.2.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-java</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-junit</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>info.cukes</groupId>

<artifactId>cucumber-picocontainer</artifactId>

<version>1.1.2</version>

</dependency>

<dependency>

<groupId>net.masterthought</groupId>

<artifactId>cucumber-reporting</artifactId>

<version>0.0.17</version>

</dependency>

<dependency>

<groupId>junit</groupId>

<artifactId>junit</artifactId>

<version>4.11</version>

</dependency>

</dependencies>

</

project>

thanks in advance 

 

 


On Wed, Mar 13, 2013 at 8:47 AM, mahesh tanneeru <tanneer...@gmail.com> wrote:
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-st
...

aslak hellesoy

unread,
Mar 13, 2013, 9:50:49 AM3/13/13
to Cucumber Users
On Wed, Mar 13, 2013 at 1:38 PM, mahesh tanneeru <tanneer...@gmail.com> wrote:
thanx aslak,
i observed my project in detail and its all messed up.
 
i created another new project with all dependiences (same version) this time i am gitting different error
 

java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/InvokerInvocationException

 

You should be able to figure this out on your own. What jar do you think that class lives in? How would you add that to your pom?

Aslak
 

--

mahesh tanneeru

unread,
Mar 13, 2013, 11:17:34 AM3/13/13
to cu...@googlegroups.com
HI Aslak, thank you very much
finally i am able to run the test but feature file didn't converted to stepdef. can you please help me with this
 
test file:
 
 
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features="C://Users//tannerum//workspace//cucumber2//src//test//resources//test1.feature",format = {"pretty", "html:target/cucumber"},tags="@mahesh")
public class Test2 {
}
 
 
when i run the above test file out put is as follows:
 
 
 
@mahesh
Feature: login
  Scenario: testlogin [90m# C:\Users\tannerum\workspace\cucumber2\src\test\resources\test1.feature:4 [0m
    Given: i am in home page
    When: i want to login
    Then: i see welcome message
 
 
is there any jar that i missed?
 
 
thanks in advance
mahesh
<font color="#008080
...

aslak hellesoy

unread,
Mar 13, 2013, 11:22:43 AM3/13/13
to Cucumber Users
On Wed, Mar 13, 2013 at 3:17 PM, mahesh tanneeru <tanneer...@gmail.com> wrote:
HI Aslak, thank you very much
finally i am able to run the test but feature file didn't converted to stepdef.

I'm sorry, I don't understand what you mean by that. Converted?
 
can you please help me with this
 
test file:
 
 
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features="C://Users//tannerum//workspace//cucumber2//src//test//resources//test1.feature",format = {"pretty", "html:target/cucumber"},tags="@mahesh")
public class Test2 {
}
 
 
when i run the above test file out put is as follows:
 
 
 
@mahesh
Feature: login
  Scenario: testlogin [90m# C:\Users\tannerum\workspace\cucumber2\src\test\resources\test1.feature:4 [0m
    Given: i am in home page
    When: i want to login
    Then: i see welcome message
 

What is the problem?

Aslak
 

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].

mahesh tanneeru

unread,
Mar 13, 2013, 11:50:25 AM3/13/13
to cu...@googlegroups.com
sorry for the confusion
 
 
according to my knowledge what i am trying to do is
 
i had a feature lile
 
 
Feature: Depositing money in to a User account
2
3Scenario: Depositing money in to User's account should add money to the User's current balance
4Given a User has no money in their account
5When £100 is deposited in to the account
6

Then the balance should be £100

 

and i had a test file

 

mport org.junit.runner.RunWith;

import cucumber.api.junit.Cucumber;


@RunWith(Cucumber.class)
@Cucumber.Options(features="C://Users//tannerum//workspace//cucumber2//src//test//resources//test1.feature",format = {"pretty", "html:target/cucumber"},tags="@mahesh")
public class Test2 {

}

when i run the test file i am expecting that to convert the features in to methods

@Given("^a User has no money in their account$")

public void a_User_has_no_money_in_their_current_account() {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@When("^£(\\d+) is deposited in to the account$")
public void £_is_deposited_in_to_the_account(int arg1) {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@Then("^the balance should be £(\\d+)$")
public void the_balance_should_be_£(int arg1) {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}

 

but i am not getting the above code insted i am just getting feature file in console.

 

thanks in advance

mahesh

<p align="left
...

aslak hellesoy

unread,
Mar 13, 2013, 12:00:58 PM3/13/13
to Cucumber Users
On Wed, Mar 13, 2013 at 3:17 PM, mahesh tanneeru <tanneer...@gmail.com> wrote:
HI Aslak, thank you very much
finally i am able to run the test but feature file didn't converted to stepdef. can you please help me with this
 
test file:
 
 
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@Cucumber.Options(features="C://Users//tannerum//workspace//cucumber2//src//test//resources//test1.feature",format = {"pretty", "html:target/cucumber"},tags="@mahesh")
public class Test2 {
}
 
 
when i run the above test file out put is as follows:
 
 
 
@mahesh
Feature: login
  Scenario: testlogin [90m# C:\Users\tannerum\workspace\cucumber2\src\test\resources\test1.feature:4 [0m
    Given: i am in home page
    When: i want to login
    Then: i see welcome message
 
 
is there any jar that i missed?
 

Cucumber can't find your stepdefs. It looks underneath the same package as your test class. The same goes for features.

What package is your test class in? You need to align the package of the test, the stepdefs and your feature files. 
Let's assume you put the test in package foo.bar.zap.

1) Move all of your features into src/test/resources/foo/bar/zap (or below)
2) Move all your stepdefs to the foo.bar.zap package (or a package below)

Now you can remove the @Cucumber.Options(features=...) since Cucumber will find your features automatically.
It will also find your stepdefs.

Aslak
 

--
-- Rules --
 
1) Please prefix the subject with [Ruby], [JVM] or [JS].

mahesh tanneeru

unread,
Mar 14, 2013, 8:36:19 AM3/14/13
to cu...@googlegroups.com
Hi Aslak,
 
i think i had some problem with my MAVEN folder
 
 
by default in my MAVEN structure there are four folders
 
src / main / java
 
src / main / java / resources
 
src / test / java
 
src / test / java / resources
 
 
i created a package 'test1' in src / test / java  and i placed my TestRunner and StepDef classes in that package
 
i created a folder 'features' in  src / test / java / resources  and i placed my features in that folder

 

and my test file is as follows

@RunWith(Cucumber.class)

@Cucumber.Options(format = {"pretty", "html:target/cucumber"},tags="@mahesh")

public class testcucumber{   }

 

test file is not identifing the features, if i am not wrong its because of folder structure.

can you please help me with this

 

thanks in advance

mahesh

 

...

aslak hellesoy

unread,
Mar 14, 2013, 8:52:55 AM3/14/13
to Cucumber Users
On Thu, Mar 14, 2013 at 12:36 PM, mahesh tanneeru <tanneer...@gmail.com> wrote:
Hi Aslak,
 
i think i had some problem with my MAVEN folder
 
 
by default in my MAVEN structure there are four folders
 
src / main / java
 
src / main / java / resources
 
src / test / java
 
src / test / java / resources
 
 

Please read up on maven.

It's src/main/resources and src/test/resources.

Aslak
 

--
Reply all
Reply to author
Forward
0 new messages