NoClassDefFoundError with Vaadin 8 Push and Spring Boot version 1.5.1

422 views Asked by At

I am getting the below error when Vaadin 8 Push enabled with Spring Boot version 1.5.1.RELEASE.

java.lang.NoClassDefFoundError: org/springframework/boot/context/embedded/ServletListenerRegistrationBean
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.getDeclaredMethods(Class.java:1975)
        at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524)
        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510)
        at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609)
        at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:96)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
        at com.xxxx.yyy.Application.main(Application.java:37)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletListenerRegistrationBean
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 23 common frames omitted

Here is build.gradle

buildscript {
    ext {
        springBootVersion = '1.5.1.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'test'
    version = '0.0.1-SNAPSHOT'
}

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compile('org.springframework.boot:spring-boot-starter-jersey')
    compile('org.springframework.boot:spring-boot-starter-web')
    testCompile('org.springframework.boot:spring-boot-starter-test')

    // Spring Boot Security
  compile("org.springframework.boot:spring-boot-starter-security")
  compile("org.springframework.security.oauth:spring-security-oauth2")
  compile('org.springframework.security:spring-security-ldap')

  // Spring Actuator
  compile("org.springframework.boot:spring-boot-starter-actuator")

  // Vaadin
  compile('com.vaadin:vaadin-spring-boot-starter')
  compile('com.vaadin:vaadin-push')

  // Vaadin add-ons
  compile("org.vaadin.spring.addons:vaadin-spring-addon-eventbus:0.0.7.RELEASE")
  compile("org.vaadin.spring.addons:vaadin-spring-addon-mvp:0.0.7.RELEASE")
  compile("org.vaadin.spring.addons:vaadin-spring-addon-i18n:0.0.7.RELEASE")

  //Vaadin extentions - in the future more of those will go to official VaadinSpring Integration
  compile("org.vaadin.spring.extensions:vaadin-spring-ext-security:0.0.7.RELEASE")
  compile("org.vaadin.spring.extensions:vaadin-spring-ext-core:0.0.7.RELEASE")
  compile("org.vaadin.spring.extensions:vaadin-spring-ext-boot:0.0.7.RELEASE")
  compile("org.vaadin.spring.extensions:vaadin-spring-ext-test:0.0.7.RELEASE")

  // lombok
  compileOnly('org.projectlombok:lombok')

}

dependencyManagement {
    imports {
        mavenBom "com.vaadin:vaadin-bom:8.0.0"
    }
}

If I disable compile('com.vaadin:vaadin-push'), there is no error but push does not work. Do you know how to make push work with Vaadin 8 and Spring Boot 5?

3

There are 3 answers

0
turgos On BEST ANSWER

This issue is fixed when I upgrade to Vaadin4Spring 2.0.0.RELEASE.

compile("org.vaadin.spring.addons:vaadin-spring-addon-eventbus:2.0.0.RELEASE") compile("org.vaadin.spring.extensions:vaadin-spring-ext-security:2.0.0.RELEASE")

0
Strelok On

This class has been deprecated since Spring Boot 1.4 and removed in 1.5 release. Downgrade to Spring Boot 1.4.5.RELEASE and wait for Vaadin to use the correct class.

0
Stephane Nicoll On

This is a known issue, please subscribe to it for update.