java - springboot 应用程序未启动 - 错误(已停止 o.s.b.c.e.j.JettyEmbeddedWebAppContext)

标签 java spring gradle spring-boot jetty

我在启动 Restful Spring Boot 应用程序时遇到问题。在看到错误堆栈跟踪时,我可以看到一些与 jetty 相关的异常。

我可以看到下面的日志。

Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,AVAILABLE}

我确实检查了C:/windows/Temp,但找不到jetty-docbase.8144885224534920922.8080

如果有人能帮助我解决这个问题,那就太好了。我如何创建该文件以便 jetty 能够识别它?

下面是完整的堆栈跟踪。

        mo.e.jetty.server.handler.ContextHandler; Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,AVAILABLE}
morg.eclipse.jetty.server.Server Started @7364ms
mationConfigEmbeddedWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
mo.e.jetty.server.handler.ContextHandle Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,UNAVAILABLE}
mo.s.boot.SpringApplication  Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at com.lewis.web.app.Application.main(Application.java:25)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 15 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)

    ... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 37 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)

提前非常感谢...

最佳答案

您的实际异常是:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"

这意味着 Spring 应用程序无法创建上下文并启动,因为无法创建某些 Bean,因为它无法解析某些所需的 Autowiring 变量,在您的情况下它是一个 build.version 。您可以尝试将此变量添加为命令行参数或将其作为属性添加到 application.properies 文件中。或者您可以找到该 bean(它的名称是 buildInformationProperties,其中该值应该是 autowird,并尝试找出为什么默认情况下没有它。

关于java - springboot 应用程序未启动 - 错误(已停止 o.s.b.c.e.j.JettyEmbeddedWebAppContext),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37974913/

相关文章:

android - 为什么我必须在 gradle 中签署 qa flavor?

java - 从 onPostExecute 调用其他类中的方法

java - 如何禁用日志记录调用路径

java - Spring @Valid 无法在 Post Controller 中正常工作(多部分)

Spring JDBC 给出 ORA-00933 : SQL command not properly ended But Query Runs OK in DB Client

spring-boot - 有没有一种简单的方法可以更改应用程序iml中的目录以构建用于测试的文件夹?

java - TreeCellEditor 在编辑单元格后执行操作

java - 应用程序使用 Intent.ACTION_SEND 时处理手机之间的差异

java - 使用spring boot无法连接MySQL数据库?

java - Selenium + gradle + testng,driver.quit()上出现UnsatisfiedLinkError