【问题标题】:Error deploying Spring boot application in Websphere 8.5.5在 Websphere 8.5.5 中部署 Spring Boot 应用程序时出错
【发布时间】:2020-01-09 13:42:51
【问题描述】:

在 Websphere 8.5.5 中启动我的应用程序时,我在标准输出中收到以下错误消息:


 1/9/20 11:56:48:437 UTC] 000000c0 SystemOut     O 11:56:48.435 [WebContainer : 3] ERROR 
 org.springframework.boot.SpringApplication - Application run failed
java.lang.IllegalStateException: Failed to load property source from location 'classpath:/application.xml'
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:545)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadForFileExtension(ConfigFileApplicationListener.java:494)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:464)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$null$7(ConfigFileApplicationListener.java:443)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader$$Lambda$290.0000000000368730.accept(Unknown Source)
    at java.lang.Iterable.forEach(Iterable.java:86)
    at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.lambda$load$8(ConfigFileApplicationListener.java:443)

我使用的spring boot版本是2.2.2。

为什么 Spring Boot 会尝试加载位于 META-INF 文件夹中的 ear 部署描述符?

【问题讨论】:

  • 因为XML 是属性的有效格式,所以.properties.xml 都已加载。 Spring 使用同时加载两者的默认属性支持。因此它尝试加载application.xml。我怀疑它在 META-INF 中,而是在你的类路径的根目录中。
  • 不是 websphere 但试试这个stackoverflow.com/questions/48955035/…

标签: spring-boot jboss websphere ear


【解决方案1】:

正如M. Deinum 所说,它给出的问题是因为 Spring Boot 试图加载 ear artifact 的 application.xml 文件以获取属性并给出解析错误,因为它没有预期的格式。

我在应用程序服务器中显示时遇到了同样的错误,它通过从 MANIFEST.MF 文件中获取路径 /META-INF

来解决

就我而言,我将战争插件包括在内:

<manifestEntries>
   <Class-Path>./ META-INF/</Class-Path>
</manifestEntries>

尝试删除该条目并重新部署。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-27
    • 1970-01-01
    • 2020-12-01
    相关资源
    最近更新 更多