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

gretty doesn't work with spring boot 1.5.2.RELEASE #392

Open
tkgospodinov opened this issue Oct 13, 2017 · 1 comment
Open

gretty doesn't work with spring boot 1.5.2.RELEASE #392

tkgospodinov opened this issue Oct 13, 2017 · 1 comment

Comments

@tkgospodinov
Copy link

Our application does not start when applying gretty:2.0.0 in conjunction with spring-boot:1.5.2.RELEASE, throwing the exception below. The root cause seems to be a conflict between the version of logback-core that spring-boot is using and the version of logback-classic version gretty is injecting:

...
|    |    +--- org.springframework.boot:spring-boot-starter-logging:1.5.2.RELEASE
|    |    |    +--- ch.qos.logback:logback-classic:1.1.11 -> 1.1.3
|    |    |    |    +--- ch.qos.logback:logback-core:1.1.3 -> 1.1.11
...
+--- ch.qos.logback:logback-classic:1.1.3 (*)
...

Exception when running with gradle jettyRun:

16:12:53 ERROR Error starting server
java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer not found
        at java.util.ServiceLoader.fail(ServiceLoader.java:239)
        at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
        at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
        at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
        at org.eclipse.jetty.annotations.AnnotationConfiguration.getNonExcludedInitializers(AnnotationConfiguration.java:786)
        at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:362)
        at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:512)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1437)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
        at org.akhikhl.gretty.JettyWebAppContext.super$10$doStart(JettyWebAppContext.groovy)
...

Relevant configuration from the build file:

buildscript {
    repositories {
        ...
    }
    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.2.RELEASE'
        classpath 'org.akhikhl.gretty:gretty:2.0.0'
    }
}

Proposed fix: Make the logback version configurable through the gretty extension, similar to the spring boot version.

GrettyPlugin.groovy:

  private void addDependencies(Project project) {
    ...
    String logbackVersion = project.gretty.logbackVersion ?: (project.hasProperty('logbackVersion') ? project.logbackVersion :Externalized.getString('logbackVersion'))
    ...
  }
tkgospodinov pushed a commit to tkgospodinov/gretty that referenced this issue Oct 13, 2017
@bmuschko
Copy link

Can you explain why you even need the Gretty plugin for a Spring Boot project? Spring Boot provides dependencies for starting the application with either Tomcat or Jetty.

javabrett pushed a commit to gretty-gradle-plugin/gretty that referenced this issue Mar 5, 2018
javabrett pushed a commit to gretty-gradle-plugin/gretty that referenced this issue Mar 5, 2018
javabrett added a commit to gretty-gradle-plugin/gretty that referenced this issue May 9, 2018
This reverts commit 5be9907.

logback upgrade is going to require some more work, as it collides with versions
present in Jetty, Spring and possibly Tomcat.

See https://travis-ci.org/gretty-gradle-plugin/gretty/jobs/376627011 for failed Travis build:

> Task :gretty-integrationTests:extraResourceBases:prepareInplaceWebApp
00:48:15 ERROR Error starting server
java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer not found
	at java.util.ServiceLoader.fail(ServiceLoader.java:239)
	at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at org.eclipse.jetty.annotations.AnnotationConfiguration.getNonExcludedInitializers(AnnotationConfiguration.java:869)
	at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:445)
	at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:479)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1337)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
	at org.akhikhl.gretty.JettyWebAppContext.super$10$doStart(JettyWebAppContext.groovy)

This is similar to issues raised in akhikhl#392 . That class was added
in Logback 1.1.10.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants