Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.sql.SQLException -> ClassDef #964

wites342 opened this Issue Jan 17, 2019 · 1 comment


None yet
2 participants
Copy link

wites342 commented Jan 17, 2019

While testing RestController with SpringBoot I got java.lang.NoClassDefFoundError: java/sql/SQLException. SpringBoot is configured to work with Jackson.


  • springboot -> 2.1.2.RELEASE
  • spock -> 1.2-groovy-2.5
  • groovy -> 2.5.4
  • jackson -> 2.9.8
  • JAVA 11
  • gradle -> 5.1.1
  • Intellij Idea 2018.3.3

Controller definition

public class MyController {

    public MyResponse getResponse() {
        return new MyResponse();

Controller test definition

class MyController extends Specification {

    private MyController myController = new MyController()

    private MockMvc mockMvc = MockMvcBuilders.standaloneSetup(controller)

    def "should return 200 OK when GET findContractsTfiDetails"() {

	private static HttpMessageConverter<?> jacksonMessageConverter() {
        MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter();
        messageConverter.setObjectMapper(new ObjectMapper()
            .registerModule(new JavaTimeModule())
        return messageConverter;


WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/PATH/groovy-2.5.5.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java.lang.NoClassDefFoundError: java/sql/SQLException

	at org.springframework.core.MethodIntrospector.selectMethods(
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.processCandidateBean(
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(
	at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(
	at org.springframework.test.web.servlet.setup.StandaloneMockMvcBuilder.registerMvcSingletons(
	at org.springframework.test.web.servlet.setup.StandaloneMockMvcBuilder.initWebAppContext(
	at my.package.MyController.$spock_initializeFields(MyController.groovy:40)
Caused by: java.lang.ClassNotFoundException: java.sql.SQLException
	at java.base/
	at java.base/java.lang.ClassLoader.loadClass(
	at java.base/java.lang.ClassLoader.loadClass(
	... 11 more


This comment has been minimized.

Copy link

leonard84 commented Jan 17, 2019

Looks like you are missing some dependency, also note that spock-1.2 does not fully support Java 11 yet, you can use the 1.3-SNAPSHOT or a jitpack build of master.
Please provide a Short, Self Contained, Correct (Compilable), Example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.