当前位置: 首页 > 知识库问答 >
问题:

Spring/application-config.xml无法打开,因为它不存在。.用Spring Boot

沃宇
2023-03-14

我试图在tomcat上部署我的war(Spring boot),但我是如何得到这个异常的。在问我自己的问题之前,我尝试了stackoverflow上的另一个问题,不幸的是,它们没有太大帮助。

它在寻找application-config.xml,在Spring boot中,我们根本没有xml配置文件。

localhost.2015-09-04.log<==04-SEP-2015 11:50:40.856严重[http-nio-8080-exec-40]org.apache.catalina.core.standardContext.ListenerStart异常向类org.springframework.web.context.context.ContextLoaderListener org.springframework.beans.factory.beanDefinitionStoreException:IOException解析来自类路径资源[spring/application-config.XML]的XML文档的侦听器实例发送嵌套异常是java.io.FileNotFoundException:无法打开类路径资源[spring/application-config.xml],因为它不存在于org.springframework.beans.factory.xml.xmlBeanDefinitionReader.loadBeanDefinitionReader(xmlBeanDefinitionReader.java:344),不存在于org.springframework.beans.factory.xml.xmlBeanDefinitionReader.java:344),不存在于y.support.abstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:217)在org.springframework.beans.factory.support.abstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)在ApplicationContext.java:94)在org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:129)在org.springframework.context.support.AbstractApplicationContext.greactFreshBeanFactory(AbstractApplicationContext.java:537)在(contextLoader.java:306)在org.springframework.web.context.contextLoaderListener.contextInitialized(contextLoaderListener.java:106)在org.apache.catalina.core.standardContext.listenerStart(standardContext.java:4729)在org.apache.catalina.core.standardContext.startInstant(standardContext.java:5167)在在org.apache.catalina.manager.htmlmanagerservlet.start(htmlmanagerservlet.java:673)在org.apache.catalina.manager.htmlmanagerservlet.doPost(htmlmanagerservlet.java:221)在javax.servlet.httpp.httpservlet.service(httpservlet.java:648)在javax.servlet.httpp.httpservlet.service(httpservlet.java:729)在ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)在org.apache.catalina.filters.csrfPreventionFilter.doFilter(csrfPreventionFilter.java:213)在org.apache.catalina.core.applicationFilterChain.internaldoFilter(ApplicationFilterChain.java:239)在org.apache.catalina.core.applicationFilterChain.doFilter(ApplicationFilterChain.java:206)在过滤器(ApplicationFilterChain.java:239)

我的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>

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

谢谢

共有1个答案

奚瑾瑜
2023-03-14

在我的例子中,xml文件是存在的。Mavenclean&compile解决了这个问题。

 类似资料: