NoClassDefFoundError 与 Vaadin 8 推送和 Spring 引导版本 1.5.1

NoClassDefFoundError with Vaadin 8 Push and Spring Boot version 1.5.1

当使用 Spring 启动版本 1.5.1.RELEASE.

启用 Vaadin 8 Push 时,我收到以下错误
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

这里是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"
    }
}

如果我禁用编译('com.vaadin:vaadin-push'),没有错误,但推送不起作用。 您知道如何使用 Vaadin 8 和 Spring Boot 5 进行推送吗?

这是a known issue,请订阅更新。

此 class 自 Spring Boot 1.4 以来已弃用,并在 1.5 版本中删除。降级到 Spring Boot 1.4.5.RELEASE 并等待 Vaadin 使用正确的 class.

当我升级到 Vaadin4Spring 2.0 时,这个问题得到解决。0.RELEASE。

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