java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/EmbeddedValueResolver

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47571523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 09:41:02  来源:igfitidea点击:

java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/EmbeddedValueResolver

javaspringmavenspring-bootjhipster

提问by Steven

I've recently managed to upgrade a jhipster generated app (Spring Boot + Angular)

我最近设法升级了 jhipster 生成的应用程序(Spring Boot + Angular)

Issue comes after cleaning code and adapting a few annotations, now I get success when doing a maven clean - install skipping testsbut when I try to start the app I get the error mentioned in the title

问题是在清理代码并调整一些注释后出现的,现在我在做 Mavenclean - install skipping tests时成功了,但是当我尝试启动应用程序时,我得到了标题中提到的错误

I've checked pom for duplicated dependencies and had a clean out of the properties file, to no result

我已经检查了 pom 是否存在重复的依赖项,并清除了属性文件,但没有结果

This is the full error:

这是完整的错误:

2017-11-30 10:12:57.821  INFO 4320 --- [  restartedMain] o.w.d.DrugQualityDataManagerApp          : Starting DrugQualityDataManagerApp on steven-OptiPlex-7040 with PID 4320 (/home/steven/Desktop/Upgraded_MQ/target/classes started by steven in /home/steven/Desktop/Upgraded_MQ)
2017-11-30 10:12:57.821  INFO 4320 --- [  restartedMain] o.w.d.DrugQualityDataManagerApp          : The following profiles are active: swagger,dev
2017-11-30 10:12:57.874 ERROR 4320 --- [  restartedMain] o.s.boot.SpringApplication               : Application startup failed

java.lang.NoClassDefFoundError: org/springframework/beans/factory/config/EmbeddedValueResolver
    at org.springframework.context.support.ApplicationContextAwareProcessor.<init>(ApplicationContextAwareProcessor.java:72)
    at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:634)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:518)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.wwarn.drugquality.DrugQualityDataManagerApp.main(DrugQualityDataManagerApp.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.factory.config.EmbeddedValueResolver
    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)
    ... 13 common frames omitted

2017-11-30 10:12:58.127  WARN 4320 --- [  restartedMain] ationConfigEmbeddedWebApplicationContext : Exception thrown from LifecycleProcessor on context close

java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@350e9339: startup date [Thu Nov 30 10:12:57 GMT 2017]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:427)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:999)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
    at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
    at org.wwarn.drugquality.DrugQualityDataManagerApp.main(DrugQualityDataManagerApp.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)

Disconnected from the target VM, address: '127.0.0.1:43599', transport: 'socket'

Process finished with exit code 1

My pom.xml(I had to embed it in a jsFiddle as it's too long for the body of an SO post)

我的pom.xml(我不得不将它嵌入到 jsFiddle 中,因为它对于 SO 帖子的正文来说太长了)

Properties file:

属性文件:

spring:
    profiles:
        active: dev
        include: swagger
    devtools:
        restart:
            enabled: true
        livereload:
            enabled: false # we use gulp + BrowserSync for livereload
    Hymanson:
        serialization.indent_output: true
    datasource:
        url: jdbc:mysql://localhost:3306/myDB?useUnicode=true&characterEncoding=utf8
        username: myDB
        password: myDB
    h2:
        console:
            enabled: false
    jpa:
        database-platform: org.hibernate.dialect.MySQLDialect
        database: MYSQL
        show_sql: false
        generate-ddl: true
        hibernate:
            ddl-auto: update
            naming:
                physical-strategy: org.wwarn.drugquality.config.HibernateAuditTablesNamingStrategy
        properties:
            hibernate.id.new_generator_mappings: true
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: true
            hibernate.cache.region.factory_class: org.hibernate.cache.jcache.JCacheRegionFactory
    data:
        elasticsearch:
            cluster-name:
            cluster-nodes:
            properties:
                path:
                    logs: target/elasticsearch/log
                    data: target/elasticsearch/data
    mail:
        host: localhost
        port: 25
        username:
        password:
    messages:
        cache-seconds: 1
    thymeleaf:
        cache: false

liquibase:
    contexts: dev

server:
    port: 8080


jhipster:
    http:
        version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
    cache: # Cache configuration
        ehcache: # Ehcache configuration
            time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
            max-entries: 100 # Number of objects in each cache entry
    # CORS is only enabled by default with the "dev" profile, so BrowserSync can access the API
    cors:
        allowed-origins: "*"
        allowed-methods: "*"
        allowed-headers: "*"
        allow-credentials: true
        max-age: 1800
    security:
        remember-me:
            # security key (this key should be unique for your application, and kept secret)
            key: daKey
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: DrugQualityDataManager@localhost
        base-url: http://127.0.0.1:8080
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        graphite: # Use the "graphite" Maven profile to have the Graphite dependencies
            enabled: false
            host: localhost
            port: 2003
            prefix: DrugQualityDataManager
        prometheus: # Use the "prometheus" Maven profile to have the Prometheus dependencies
            enabled: false
            endpoint: /prometheusMetrics
        logs: # Reports Dropwizard metrics in the logs
            enabled: false
            report-frequency: 60 # in seconds
    logging:
        logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
            enabled: false
            host: localhost
            port: 5000
            queue-size: 512


# ===================================================================
# Application specific properties
# Add your own application properties here, see the ApplicationProperties class
# to have type-safe configuration, like in the JHipsterProperties above
#
# More documentation is available at:
# http://www.jhipster.tech/common-application-properties/
# ===================================================================

application:

回答by Matt

In your fiddled pom there is this dep:

在你摆弄的 pom 中有这个 dep:

<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>4.2.9.RELEASE</version>
</dependency>

The EmbeddedValueResolver was introduced in Spring 4.3

EmbeddedValueResolver 是在Spring 4.3中引入的

You might want to clean up your dependencies. Perhaps it's sufficient to pull spring-beans up to 4.3

您可能想要清理您的依赖项。或许把 spring-beans 拉到 4.3 就够了