Skip to content
Advertisement

java.lang.RuntimeException: not supported: class org.spockframework.gentyref.CaptureTypeImpl

Spock is being used to execute an integration test in a Spring Boot project (2.1.18.RELEASE). When I run with 1.3-groovy-2.5, I get this error:

JavaScript

If I update Spock to a more recent version (eg. 2.1-groovy-2.5) I get this error:

JavaScript

I am using Java 11 and Maven 3.6.3. My pom.xml is rather long, so I’ve reduced it to some snippets that focus on versions and test dependencies:

JavaScript

Any help with troubleshooting this further is greatly appreciated. I modelled my pom.xml after the examples in the spock framework project:

Advertisement

Answer

Regarding java.util.ServiceConfigurationError: org.junit.platform.engine.TestEngine: org.spockframework.runtime.SpockEngine Unable to get public no-arg constructor

Spring Boot 2.1.18.RELEASE is really old, it manages JUnit 5 to 5.3.2 while Spock 2.x requires >= 5.8. You can try setting <junit-jupiter.version>5.8.1</junit-jupiter.version> if you can’t upgrade Spring Boot to a more recent version.

As for the type reflection error, we can’t say much since you didn’t share any code. Only that com.foo.controller.ConversionsController.createConversionJob(ConversionsController.java:68) probably has some weird generics or is calling something that does.

Advertisement