Spring boot Jersey with groovy/gradle fails on startup
Asked Answered
C

1

0

We're just starting a new project, and are looking into spring-boot for kickstarting our development. spring-boot seems powerful, but there's some magic going on that we yet don't understand.

I've cloned the spring-boot samples and ran the Jersey Example. So far so good.

I then converted this to Groovy/Gradle.

relevant sections of the build script looks like this

.
.
buildscript {
    repositories {
        jcenter()
//        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.M2")
        classpath 'org.springframework:springloaded:1.2.0.RELEASE'
    }
}
.
.
apply plugin: 'spring-boot'
.
.
dependencies {
    compile project(':domain')
    compile "org.springframework.boot:spring-boot-starter-jersey",
            "org.glassfish.jersey.media:jersey-media-moxy:2.13"
}

when running gradle bootRun the application fails to start

the exception is

    org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:51)
        2014-10-29 09:38:01.982 ERROR 17977 --- [           main] o.s.boot.SpringApplication               : Application startup failed
            at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)

            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:177)
        java.lang.IllegalStateException: Could not evaluate condition owing to internal class not found. This c at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:146)
        an happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:122)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:51)
            at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:318)
            at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:102)
            at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:239)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:177)
            at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:254)
            at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:146)
            at .
    .
    .
    .
        pplicationBuilder.java:143)
        Caused by: java.lang.NoClassDefFoundError: org/springframework/web/serv at org.springframework.boot.builder.SpringApplicationBuilder$run.call(Unknown Source)
        let/view/UrlBasedViewResolver
            at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
            at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            at geit.ApiApplication.main(ApiApplication.groovy:28)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        Caused by: java.lang.NoClassDefFoundError: org/springframework/web/servlet/view/UrlBasedViewResolver
            at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
            at java.security.AccessController.doPrivileged(Native Method)
..
.
.       org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:145)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)
            at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
            at java.lang.Class.getDeclaredMethods(Class.java:1855)
            at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:534)
            at org.springsource.loaded.ri.ReflectiveInterceptor.jlClassGetDeclaredMethods(ReflectiveInterceptor.java:145)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:678)
            at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)
            at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
            at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:534)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeaat org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireC                                                                                                                                                      mesForType(DefaultListableBeanFactory.java:404)
        apableBeanFactory.java:678)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:373)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:622)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:165)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:592)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:153)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1394)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:122)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:404)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:96)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:373)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:165)
            ... 19 more
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:153)
        Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.UrlBasedViewResolver
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:122)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:96)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:45)
            at java.security.AccessController.doPrivileged(Native Method)
            ... 19 common frames omitted
            at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        Caused by: java.lang.ClassNotFoundException: org.springframework.web.servlet.view.UrlBasedViewResolver
            at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
            at java.security.AccessController.doPrivileged(Native Method)
            ... 50 more 
        2014-10-29 09:38:01.983  INFO 17977 --- [           main] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@76e68f                                                                                                                                                            59: startup date [Wed Oct 29 
        FAILURE: Build failed with an exception.

To solve this ClassNotFoundException I add the following dependency "org.springframework:spring-webmvc"

when running gradle bootRun the application starts

However, this also triggers alot of extra setup that I really don't want

This is the log from the spring-boot-samples using Maven

2014-10-29 09:43:01.466  INFO 18089 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1414 ms
2014-10-29 09:43:01.612  INFO 18089 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'jerseyServlet' to [/*]
2014-10-29 09:43:01.614  INFO 18089 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2014-10-29 09:43:02.071  INFO 18089 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-10-29 09:43:02.081  INFO 18089 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Initializing ProtocolHandler ["http-nio-8080"]
2014-10-29 09:43:02.089  INFO 18089 --- [           main] o.a.coyote.http11.Http11NioProtocol      : Starting ProtocolHandler ["http-nio-8080"]
2014-10-29 09:43:02.096  INFO 18089 --- [           main] o.a.tomcat.util.net.NioSelectorPool      : Using a shared selector for servlet write/read
2014-10-29 09:43:02.109  INFO 18089 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-10-29 09:43:02.111  INFO 18089 --- [           main] sample.jersey.SampleJerseyApplication    : Started SampleJerseyApplication in 2.456 seconds (JVM running for 2.792)

This is the log from my gradle build, including the spring-webmvc dependency

2014-10-29 09:42:20.276  INFO 18078 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2014-10-29 09:42:20.277  INFO 18078 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 5680 ms
2014-10-29 09:42:20.881  INFO 18078 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'jerseyServlet' to [/*]
2014-10-29 09:42:20.883  INFO 18078 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'dispatcherServlet' to [/]
2014-10-29 09:42:20.884  INFO 18078 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
2014-10-29 09:42:20.885  INFO 18078 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2014-10-29 09:42:21.204  INFO 18078 --- [           main] o.s.b.f.xml.XmlBeanDefinitionReader      : Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
2014-10-29 09:42:21.239  INFO 18078 --- [           main] o.s.jdbc.support.SQLErrorCodesFactory    : SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
2014-10-29 09:42:21.510  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.649  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3450feef: startup date [Wed Oct 29 09:42:14 CET 2014]; root of context hierarchy
2014-10-29 09:42:22.064  INFO 18078 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2014-10-29 09:42:22.115  INFO 18078 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080/http
2014-10-29 09:42:22.118  INFO 18078 --- [           main] geit.ApiApplication                      : Started ApiApplication in 8.126 seconds (JVM running for 9.259)
> 2014-10-29 09:42:51.012  INFO 18078 --- [       Thread-2] ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3450feef: startup date [Wed Oct 29 09:42:14 CET 2014]; root of context hierarchy

As we can see, the following is now auto registered

Mapping servlet: 'dispatcherServlet' to [/] Mapping filter: 'hiddenHttpMethodFilter' to: [/*]

and spring-webmvc is mapping urls

2014-10-29 09:42:21.510  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.580  INFO 18078 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],methods=[],params=[],headers=[],consumes=[],produces=[text/html],custom=[]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2014-10-29 09:42:21.611  INFO 18078 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]

I am not sure why I need to include the spring-webmvc dependency to actually start the server when using gradle, as opposed to using Maven? I want to solve this before proceeding with spring-boot so that we don't run into springmvc/jersey conflicts later on Is this a bug? As user error?

Any help appreciated :)

Application class

@ComponentScan
@EnableAutoConfiguration
class ApiApplication extends SpringBootServletInitializer {
//class ApiApplication {

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApiApplication);
    }

    static void main(String[] args) {
        new ApiApplication()
                .configure(new SpringApplicationBuilder(ApiApplication))
                .run(args);
//        SpringApplication.run ApiApplication, args
    }

}

Simplified build script

I have simplified the build script, no multimodule build, just spring-boot-jersey. Rest of the code is from the samples. It still fails.

buildscript {
        repositories {
            jcenter()
            maven { url "http://repo.spring.io/snapshot" }
            maven { url "http://repo.spring.io/milestone" }
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.0.BUILD-SNAPSHOT")
    //        classpath 'org.springframework:springloaded:1.2.0.RELEASE'
        }
    }

    repositories {
    //    jcenter()
        mavenLocal()
        mavenCentral()
        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/milestone" }
    }


    apply plugin: 'idea'
    apply plugin: 'java'
    //apply plugin: 'groovy'
    apply plugin: 'spring-boot'


    version = '0.1-SNAPSHOT'


    jar {
        baseName = 'jersey-test'
    }

    dependencies {
        compile "org.codehaus.groovy:groovy-all:2.3.7"
        compile "org.springframework.boot:spring-boot-starter-jersey",
                "org.glassfish.jersey.media:jersey-media-moxy:2.7"
        testCompile "org.springframework.boot:spring-boot-starter-test"
    }

Dependencies from the simpliefied build*

~/Development/git-repos/geitkontroll/jersey-test (geit-32) $ gradle dependencies --configuration runtime
:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

runtime - Runtime classpath for source set 'main'.
+--- org.codehaus.groovy:groovy-all:2.3.7
+--- org.springframework.boot:spring-boot-starter-jersey: -> 1.2.0.M2
|    +--- org.springframework.boot:spring-boot-starter:1.2.0.M2
|    |    +--- org.springframework.boot:spring-boot:1.2.0.M2
|    |    |    +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |    \--- org.springframework:spring-context:4.1.1.RELEASE
|    |    |         +--- org.springframework:spring-aop:4.1.1.RELEASE
|    |    |         |    +--- aopalliance:aopalliance:1.0
|    |    |         |    +--- org.springframework:spring-beans:4.1.1.RELEASE
|    |    |         |    |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         +--- org.springframework:spring-beans:4.1.1.RELEASE (*)
|    |    |         +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    |         \--- org.springframework:spring-expression:4.1.1.RELEASE
|    |    |              \--- org.springframework:spring-core:4.1.1.RELEASE
|    |    +--- org.springframework.boot:spring-boot-autoconfigure:1.2.0.M2
|    |    |    \--- org.springframework.boot:spring-boot:1.2.0.M2 (*)
|    |    +--- org.springframework.boot:spring-boot-starter-logging:1.2.0.M2
|    |    |    +--- org.slf4j:jcl-over-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    +--- org.slf4j:jul-to-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    +--- org.slf4j:log4j-over-slf4j:1.7.7
|    |    |    |    \--- org.slf4j:slf4j-api:1.7.7
|    |    |    \--- ch.qos.logback:logback-classic:1.1.2
|    |    |         +--- ch.qos.logback:logback-core:1.1.2
|    |    |         \--- org.slf4j:slf4j-api:1.7.6 -> 1.7.7
|    |    +--- org.springframework:spring-core:4.1.1.RELEASE
|    |    \--- org.yaml:snakeyaml:1.13
|    +--- org.springframework.boot:spring-boot-starter-tomcat:1.2.0.M2
|    |    +--- org.apache.tomcat.embed:tomcat-embed-core:7.0.55
|    |    +--- org.apache.tomcat.embed:tomcat-embed-el:7.0.55
|    |    \--- org.apache.tomcat.embed:tomcat-embed-logging-juli:7.0.55
|    +--- com.fasterxml.jackson.core:jackson-databind:2.4.2
|    |    +--- com.fasterxml.jackson.core:jackson-annotations:2.4.0
|    |    \--- com.fasterxml.jackson.core:jackson-core:2.4.2
|    +--- org.hibernate:hibernate-validator:5.1.2.Final
|    |    +--- javax.validation:validation-api:1.1.0.Final
|    |    +--- org.jboss.logging:jboss-logging:3.1.3.GA
|    |    \--- com.fasterxml:classmate:1.0.0
|    +--- org.springframework:spring-core:4.1.1.RELEASE
|    +--- org.springframework:spring-web:4.1.1.RELEASE
|    |    +--- org.springframework:spring-aop:4.1.1.RELEASE (*)
|    |    +--- org.springframework:spring-beans:4.1.1.RELEASE (*)
|    |    +--- org.springframework:spring-context:4.1.1.RELEASE (*)
|    |    \--- org.springframework:spring-core:4.1.1.RELEASE
|    +--- org.glassfish.jersey.core:jersey-server:2.7
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7
|    |    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    |    +--- org.glassfish.jersey.bundles.repackaged:jersey-guava:2.7
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0
|    |    |    |    +--- javax.inject:javax.inject:1
|    |    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0
|    |    |    |    |    \--- javax.inject:javax.inject:1
|    |    |    |    \--- org.glassfish.hk2.external:aopalliance-repackaged:2.2.0
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    +--- org.glassfish.hk2:hk2-locator:2.2.0
|    |    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    |    +--- org.glassfish.hk2.external:aopalliance-repackaged:2.2.0
|    |    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    |    |    +--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|    |    |    |    \--- org.javassist:javassist:3.18.1-GA
|    |    |    \--- org.glassfish.hk2:osgi-resource-locator:1.0.1
|    |    +--- org.glassfish.jersey.core:jersey-client:2.7
|    |    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    |    \--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|    |    +--- javax.ws.rs:javax.ws.rs-api:2.0
|    |    +--- javax.annotation:javax.annotation-api:1.2
|    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|    |    \--- javax.validation:validation-api:1.1.0.Final
|    +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7
|    |    +--- org.glassfish.hk2.external:javax.inject:2.2.0
|    |    +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    \--- javax.ws.rs:javax.ws.rs-api:2.0
|    +--- org.glassfish.jersey.containers:jersey-container-servlet:2.7
|    |    +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
|    |    +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|    |    \--- javax.ws.rs:javax.ws.rs-api:2.0
|    \--- org.glassfish.jersey.ext:jersey-spring3:2.7
|         +--- org.glassfish.jersey.core:jersey-server:2.7 (*)
|         +--- org.glassfish.jersey.containers:jersey-container-servlet-core:2.7 (*)
|         +--- org.glassfish.hk2:hk2:2.2.0
|         |    +--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|         |    +--- org.glassfish.hk2:config-types:2.2.0
|         |    |    \--- org.glassfish.hk2:hk2-config:2.2.0
|         |    |         +--- org.glassfish.hk2:core:2.2.0
|         |    |         |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    |         |    \--- org.glassfish.hk2:hk2-utils:2.2.0 (*)
|         |    |         +--- org.jvnet:tiger-types:1.4
|         |    |         \--- org.glassfish.hk2.external:bean-validator:2.2.0
|         |    +--- org.glassfish.hk2:core:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-config:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    +--- org.glassfish.hk2:hk2-runlevel:2.2.0
|         |    |    +--- org.glassfish.hk2:hk2-api:2.2.0 (*)
|         |    |    \--- org.glassfish.hk2:hk2-locator:2.2.0 (*)
|         |    \--- org.glassfish.hk2:class-model:2.2.0
|         |         \--- junit:junit:4.3.1
|         +--- org.glassfish.hk2:spring-bridge:2.2.0
|         |    \--- org.springframework:spring-context:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         +--- org.springframework:spring-beans:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         +--- org.springframework:spring-core:3.2.3.RELEASE -> 4.1.1.RELEASE
|         +--- org.springframework:spring-web:3.2.3.RELEASE -> 4.1.1.RELEASE (*)
|         \--- javax.ws.rs:javax.ws.rs-api:2.0
\--- org.glassfish.jersey.media:jersey-media-moxy:2.7
     +--- org.glassfish.jersey.core:jersey-common:2.7 (*)
     +--- org.glassfish.jersey.ext:jersey-entity-filtering:2.7
     |    \--- javax.ws.rs:javax.ws.rs-api:2.0
     +--- org.eclipse.persistence:org.eclipse.persistence.moxy:2.5.0
     |    +--- org.eclipse.persistence:org.eclipse.persistence.core:2.5.0
     |    |    \--- org.eclipse.persistence:org.eclipse.persistence.asm:2.5.0
     |    \--- org.eclipse.persistence:org.eclipse.persistence.antlr:2.5.0
     \--- org.eclipse.persistence:org.eclipse.persistence.antlr:2.5.0

(*) - dependencies omitted (listed previously)
Carlton answered 29/10, 2014 at 9:5 Comment(10)
Are u using @EnableAutoConfigurationCeballos
You shouldn't need a dependency on spring-webmvc: the Maven-based Jersey sample doesn't depend on it. I can build and run the sample using Gradle with dependencies on jersey-media-moxy and spring-boot-starter-jersey so I suspect it must be something that's being pulled in by your domain project that's triggered the problem. Can you update the question with the output from ./gradlew dependencies --configuration runtime?Wide
Also, as the error recommends, have you checked that you're not component scanning Spring classes? For example because you've put @ComponentScan on a class in the default package.Wide
Yes, using @EnableAutoConfigurationCarlton
I've updated with the Application class. This is not in the default package.Carlton
Unable to add update of dependencies task due to size limit. Are there other ways of sharing this info?Carlton
Please see updated question. I have updated/simplified the build. Still the same error. Using the same code as the samplesCarlton
dependencies report added. Had to remove some of the stacktrace due to size limitCarlton
Ok, I have checked out the samples, copied the simplified build script to the root dir, and ran gradle compileJava then gradle bootRun. It still fails. @AndyWilkinson - I am not sure how you are able to run the samples with gradle. Can you test with the gradle script above?Carlton
@AndyWilkinson I have isolated the problem to the compile dependency "org.codehaus.groovy:groovy-all:2.3.7". When including this dependency, the error occurs. I am not sure how to bypass this problem, as we are using standalone gorm and thus needs the different groovy modulesCarlton
W
0

You've found a bug in Spring Boot. Thanks for the help in tracking it down. As mentioned in the bug report you can work around the problem by excluding the auto-configuration for Groovy templates:

@ComponentScan
@EnableAutoConfiguration(exclude=GroovyTemplateAutoConfiguration.class)
class ApiApplication extends SpringBootServletInitializer {

    // …
}
Wide answered 30/10, 2014 at 14:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.