【问题标题】:spring/application-config.xml cannot be opened because it does not exist ..with Spring bootspring/application-config.xml 无法打开,因为它不存在 ..with Spring boot
【发布时间】:2015-11-30 11:03:22
【问题描述】:

我试图在 tomcat 上部署我的战争(Spring boot),但有些我是如何得到这个异常的。在问我自己之前,我已经尝试过关于 stackoverflow 的另一个问题,不幸的是它们没有多大帮助。

它正在寻找 Application-config.xml,而在 Spring Boot 中我们根本没有 xml 配置文件。

我正在使用 Maven 创建战争。

任何指针都会有所帮助。

例外

localhost.2015-09-04.log

我的 pom.xml

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>1.2.5.RELEASE</version>
    </dependency>
    <!-- This dependency is used ,so that embedded server is not part of war -->
    <!-- <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency> -->
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-mapper-asl</artifactId>
        <version>1.8.5</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>
</dependencies>

如果我需要更多信息,请告诉我。因为我不确定解释我的问题需要什么。我刚刚提供了 Exception 和 pom。

谢谢

【问题讨论】:

  • 嗯,错误很明显,文件不存在...确保文件在您指定的位置。
  • M.Deinum :当然它是自我解释的,但在 Spring Boot 中不使用 ..xml。 :)
  • 在您的源代码中搜索此字符串“application-config.xml”!它是否在任何类上引用(注解...)
  • @Roxy 您是否尝试过执行 maven clean 然后重建战争?
  • @geoand ...好吧,这听起来很愚蠢,但是是的,清洁和建筑...对我有用。谢谢:)

标签: spring spring-mvc tomcat spring-boot


【解决方案1】:

在我的例子中,xml 文件存在。 Maven Clean &amp; Compile 解决了这个问题。

【讨论】:

    猜你喜欢
    • 2021-12-14
    • 2011-04-23
    • 2016-09-08
    • 2019-07-12
    • 2018-03-26
    • 2015-06-11
    • 2017-02-19
    • 1970-01-01
    • 2012-01-01
    相关资源
    最近更新 更多