I am getting this stack trace when running a very basic feature which just opens a browser, navigates to google.com and search some string.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/springframework/transaction/TransactionStatus
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.getMethods(Class.java:1615)
at cucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40)
at cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:86)
at cucumber.runtime.Runtime.<init>(Runtime.java:92)
at cucumber.runtime.Runtime.<init>(Runtime.java:70)
at cucumber.runtime.Runtime.<init>(Runtime.java:66)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException:
org.springframework.transaction.TransactionStatus
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 11 more
Can someone tell me what is missing here?
For Intellij 2018.1 and i guess for early versions, the Run configuration by default gets the Glue 'cucumber.api.spring' , you should switch it for 'com.foreach.cuke'
Go to 'Edit Configurations' - 'Cucumber' - Glue: com.foreach.cuke ...
The below dependency is missing. Default glue cucumber.api.spring
is not able to find class transaction so it throws an error. Add dependency to your pom.xml
and it will solve your issue
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
You should switch The Run configuration to 'com.foreach.cuke'
instead of 'cucumber.api.spring'..
Go to 'Edit Configurations'
- 'Cucumber'
- Glue: com.foreach.cuke
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With