[英]Element web-app must be declared error in Intellij
I work in a project that I have a logback-test.xml
file and the file shows error. 我在一个有logback-test.xml
文件的项目中工作,该文件显示错误。 It's a multi-module maven project and the file mentioned is provided below, 这是一个多模块的maven项目,下面提供了提到的文件,
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
version="2.5">
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%t] %-5p %c:%L - %m%n</pattern>
</encoder>
</appender>
<logger name="org.springframework" level="ERROR"/>
<logger name="com.ratepay" level="ERROR"/>
<root level="ERROR">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
</web-app>
When I hold the cursor atop of the web-app
tag, I get the error as Element web-app must be declared
. 当我将光标停留在web-app
标签的顶部时,由于Element web-app must be declared
,我得到了错误。 My colleague use the Eclipse
and he doesn't have the same error. 我的同事使用Eclipse
,但没有相同的错误。
I have seen a few answers for the issue, but, can anyone clearly explain why does it see this? 我已经看到了该问题的一些答案,但是,谁能清楚地解释为什么会看到此问题?
Remove the following portion for logback.xml from the beginning. 从一开始就删除logback.xml的以下部分。
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd"
version="2.5">
Remove the following portion from the last. 从最后删除以下部分。
</web-app>
It is not a web.xml which is deployment descriptor. 它不是作为部署描述符的web.xml。 logback.xml and web.xml are aparently different. logback.xml和web.xml显然有所不同。
In case of logback.xml, the final structure should be like this given below. 对于logback.xml,最终结构应如下所示。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d [%t] %-5p %c:%L - %m%n</pattern>
</encoder>
</appender>
<logger name="org.springframework" level="ERROR"/>
<logger name="com.ratepay" level="ERROR"/>
<root level="ERROR">
<appender-ref ref="CONSOLE"/>
</root>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.