question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cucumber-java8 fails on OpenJDK 1.8.0

See original GitHub issue

Cucumber-Java8 depends on internals of the implementation of Oracle’s JDK8. When I started experimenting with it I just always got the following exception:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.056 sec <<< FAILURE! - in soy.wimmer.CucumberIT
Feature: Cucumber with Java8  Time elapsed: 0.047 sec  <<< ERROR!            
cucumber.runtime.CucumberException: Failed to instantiate class soy.wimmer.CucumberStepdefs
[…]                                                                          
Caused by: java.lang.reflect.InvocationTargetException: null                 
[…]                                                                          
Caused by: cucumber.runtime.CucumberException: java.lang.IllegalArgumentException: Wrong type at constant pool index
[…]                                                                          
Caused by: java.lang.IllegalArgumentException: Wrong type at constant pool index
    at sun.reflect.ConstantPool.getMemberRefInfoAt0(Native Method)           
    at sun.reflect.ConstantPool.getMemberRefInfoAt(ConstantPool.java:47)     
    at cucumber.runtime.java8.ConstantPoolTypeIntrospector.getTypeString(ConstantPoolTypeIntrospector.java:37)
    at cucumber.runtime.java8.ConstantPoolTypeIntrospector.getGenericTypes(ConstantPoolTypeIntrospector.java:27)
    at cucumber.runtime.java.Java8StepDefinition.<init>(Java8StepDefinition.java:45)
    at cucumber.runtime.java.JavaBackend.addStepDefinition(JavaBackend.java:162)
    at cucumber.api.java8.En.Given(En.java:190)                              
    at soy.wimmer.CucumberStepdefs.<init>(CucumberStepdefs.java:8)           
[…]

The test project causing this output is available at https://github.com/mawis/cucumber-java8-test

While it fails on OpenJDK8 it works without problems on Oracle JDK8. I consider this to be a bug, as I don’t think that cucumber should depend on a specific implementation of the compiler.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:63 (32 by maintainers)

github_iconTop GitHub Comments

1reaction
brasmussoncommented, Aug 2, 2016

@Grief Hopefully a 1.2.5-version will not have to wait to far into the future, but #1034 is better fixed before that. Until then the latest build on the master is available as a snapshot release.

0reactions
mpkorstanjecommented, Jan 26, 2019

Upgrade. Check the version badge in the readme.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in thread "main" cucumber.runtime ...
This error is thrown when no 'backends' are found on the classpath. There is a 'backend' for each supported language (e.g. cucumber-java, ...
Read more >
[CUCUMBER-JVM] Not Instantiating Step Definitions
I'm going through the CucumberJVM book but using Java 8 instead and I'm ... CucumberException: Failed to instantiate class step_definitions.
Read more >
UnsupportedClassVersionError when running cucumber tests ...
When I try to run my Cucumber run configurations I get the error below. It seems CucumberJvm4SMFormatter is now compiled with Java 11...
Read more >
cucumber-jvm : 6.8.0 - Maven Central Repository Search
... </dependency> <dependency> <groupId>io.cucumber</groupId> <artifactId>cucumber-java8</artifactId> <version>${project.version}</version> </dependency> ...
Read more >
Cucumber-JVM
Make sure the Cucumber version is the same for all Cucumber dependencies. Maven. Add the following dependency to your pom.xml : <dependency> <groupId>io....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found