Обновлен до Spring-Boot 1.5.9 (с 1.3.x) - ClassNotFoundException для ServletRegistrationBean - PullRequest
0 голосов
/ 26 апреля 2018

Я пытаюсь перейти на Spring Boot 1.5.9, и пока он компилируется, во время выполнения я получаю следующее исключение. Я попытался перейти на загрузку, попытался обновить Spring-Cloud (Edgware, Brixton и т. Д.), Но безуспешно. Я знаю, что мой код не использует этот класс (он не будет компилироваться, если так). Как найти оскорбительную зависимость (если это так)? Мой pom.xml огромен, с большим количеством внутренних артефактов, поэтому публиковать полезные вещи не имеет смысла.

java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$EndpointWebMvcConfiguration due to org/springframework/boot/context/embedded/ServletRegistrationBean not found. Make sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:55) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE] ......

Caused by: java.lang.ClassNotFoundException: org.springframework.boot.context.embedded.ServletRegistrationBean
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[?:1.8.0_161]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_161]
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94) ~[lbossvc.jar:2.434.0]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_161]
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[?:1.8.0_161]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[?:1.8.0_161]
    at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[?:1.8.0_161]
    at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:613) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:524) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:510) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.util.ReflectionUtils.getUniqueDeclaredMethods(ReflectionUtils.java:570) ~[spring-core-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:697) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:640) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:609) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1484) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:425) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:395) ~[spring-beans-4.3.13.RELEASE.jar!/:4.3.13.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ManagementServerPort.hasCustomBeanDefinition(EndpointWebMvcAutoConfiguration.java:424) ~[spring-boot-actuator-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ManagementServerPort.hasCustomBeanDefinition(EndpointWebMvcAutoConfiguration.java:417) ~[spring-boot-actuator-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ManagementServerPort.get(EndpointWebMvcAutoConfiguration.java:368) ~[spring-boot-actuator-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
    at org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$OnManagementMvcCondition.getMatchOutcome(EndpointWebMvcAutoConfiguration.java:345) ~[spring-boot-actuator-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]
    at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47) ~[spring-boot-autoconfigure-1.5.9.RELEASE.jar!/:1.5.9.RELEASE]

Вот мои зависимости Spring:

    org.springframework:spring-context:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.cloud:spring-cloud-starter-netflix-archaius:jar:1.4.4.RELEASE:compile
[INFO]    org.springframework.data:spring-data-commons:jar:1.13.9.RELEASE:compile
[INFO]    org.springframework.restdocs:spring-restdocs-core:jar:1.1.2.RELEASE:test
[INFO]    org.springframework.cloud:spring-cloud-context:jar:1.3.3.RELEASE:compile
[INFO]    org.springframework.cloud:spring-cloud-commons:jar:1.3.3.RELEASE:compile
[INFO]    org.springframework:spring-context-support:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.security:spring-security-crypto:jar:4.2.3.RELEASE:compile
[INFO]    org.springframework.cloud:spring-cloud-starter-netflix-hystrix:jar:1.4.4.RELEASE:compile
[INFO]    org.springframework:spring-beans:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework:spring-expression:jar:4.3.13.RELEASE:compile
[INFO]    io.springfox:springfox-swagger-ui:jar:2.8.0:compile
[INFO]    org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
[INFO]    org.springframework:spring-aop:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.9.RELEASE:compile
[INFO]    io.springfox:springfox-swagger2:jar:2.8.0:compile
[INFO]    org.springframework:spring-core:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter-web:jar:1.5.9.RELEASE:compile
[INFO]    io.springfox:springfox-spi:jar:2.8.0:compile
[INFO]    org.springframework.boot:spring-boot-starter-test:jar:1.5.9.RELEASE:test
[INFO]    org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
[INFO]    org.springframework:spring-jdbc:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-test:jar:1.5.9.RELEASE:test
[INFO]    org.springframework.boot:spring-boot-starter-actuator:jar:1.5.9.RELEASE:compile
[INFO]    io.springfox:springfox-schema:jar:2.8.0:compile
[INFO]    io.springfox:springfox-core:jar:2.8.0:compile
[INFO]    org.springframework.cloud:spring-cloud-starter:jar:1.3.3.RELEASE:compile
[INFO]    org.springframework.data:spring-data-keyvalue:jar:1.2.9.RELEASE:compile
[INFO]    org.springframework.security:spring-security-rsa:jar:1.0.3.RELEASE:compile
[INFO]    org.springframework.data:spring-data-redis:jar:1.7.5.RELEASE:compile
[INFO]    org.springframework:spring-oxm:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-configuration-processor:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter-undertow:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework:spring-test:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.cloud:spring-cloud-netflix-core:jar:1.4.4.RELEASE:compile
[INFO]    org.springframework.restdocs:spring-restdocs-mockmvc:jar:1.1.2.RELEASE:test
[INFO]    org.springframework.boot:spring-boot-actuator:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework.retry:spring-retry:jar:1.0.3.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.9.RELEASE:test
[INFO]    io.springfox:springfox-swagger-common:jar:2.8.0:compile
[INFO]    io.springfox:springfox-spring-web:jar:2.8.0:compile
[INFO]    org.springframework:spring-web:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter-log4j2:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework:spring-tx:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework.cloud:spring-cloud-starter-hystrix:jar:1.4.4.RELEASE:compile
[INFO]    org.springframework:spring-jmx:jar:2.0.8:compile
[INFO]    org.springframework.boot:spring-boot-autoconfigure:jar:1.5.9.RELEASE:compile
[INFO]    org.springframework:spring-webmvc:jar:4.3.13.RELEASE:compile
[INFO]    org.springframework.boot:spring-boot-starter-aop:jar:1.5.9.RELEASE:compile

1 Ответ

0 голосов
/ 27 апреля 2018

Как оказалось, я был прав в своем предположении - одна из моих внутренних зависимостей заключалась в импорте ServletRegistrationBean из более ранней версии Spring-Boot (пакет контекста или веб-пакет). Было два возможных исправления, так как я не был уверен, что смогу обновить зависимость. Один из них заключался в создании полностью квалифицированного класса, который просто расширял ServletRegistrationBean с использованием старого пакета, другой - в обновлении зависимости. Оба будут работать, хотя первый очень хакерский. К счастью, я мог обновить зависимый код, как я это исправил.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...