Intellij说,web-inf中不存在文件,但确实存在 [英] Intellij, says a file doesn't exist in web-inf, but it does

查看:49
本文介绍了Intellij说,web-inf中不存在文件,但确实存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我昨天安装了Intellij,以查看它与Eclipse相比如何.

I installed Intellij yesterday to see how it compared to Eclipse.

我已经创建了一个Maven项目,导入了Spring的依赖项,并设置了我认为测试应用程序运行所需的一切.

I've created a Maven project, imported the dependencies for Spring and setup everything I think I need to test the application runs.

我遇到的问题是,在web.xml文件中,它确实存在时将servlet配置文件之一标记为未找到.我猜想这与web-inf文件夹的映射有关,但是我无法在Intellij中弄清楚

The issue I have is that in the web.xml file it's marking one of the servlet configuration files as not found, when it does exist. I'm guessing this has something to do with the mapping of the web-inf folder, but I can't figure it out in Intellij

这是web.xml文件的内容

Here's the content of the web.xml file

<servlet>
        <servlet-name>dispatcher</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/spring/dispatcher-servlet.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>dispatcher</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

我也包括了我的文件夹结构的屏幕截图.

I'm including a screenshot of my folder structure too.

路径映射得很好,但随后我将工件更改为战争而不是爆炸,它似乎已经损坏了一些东西.

The path was mapping fine, but then I change the artifact to be a war instead of exploded, and it seems to have broken something.

应用程序运行时的错误消息是;

The error message on application run is;

IOException parsing XML document from ServletContext resource [/WEB-INF/spring/dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException:

任何帮助将不胜感激.

推荐答案

可能这一点会更清楚:

  1. 项目结构:

  1. project structure:

将webapp文件夹设置为资源:

set webapp folder as resources:

这篇关于Intellij说,web-inf中不存在文件,但确实存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆