我试图在我的web应用程序和部署时间中使用两个web片段,我得到了以下错误:
INFO: Starting Servlet Engine: Apache Tomcat/8.0.21
mai 02, 2017 9:02:43 PM org.apache.tomcat.util.descriptor.web.WebXml merge
SEVERE: The display name was defined in multiple fragments with different values including fragment with name [wf2] located at [jar:file:/home/christian/christian/work/workspaces/neon2/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/web1/WEB-INF/lib/wf2-0.0.1-SNAPSHOT.jar!/]
mai 02, 2017 9:02:43 PM org.apache.catalina.startup.ContextConfig configureStart
SEVERE: Marking this application unavailable due to previous error(s)
mai 02, 2017 9:02:43 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error getConfigured
mai 02, 2017 9:02:43 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/web1] startup failed due to previous errors
mai 02, 2017 9:02:43 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
mai 02, 2017 9:02:43 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
mai 02, 2017 9:02:43 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 355 ms我试图更改web片段. and的名称和diplay标记值,但是错误仍然存在。当我只使用我的pom中的一个网页片段时,它可以正常工作。
下面是两个web片段: wf1
<?xml version="1.0" encoding="UTF-8"?>
<web-fragment id="WebFragment_ID" version="3.1"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd">
<display-name>wf1</display-name>
<name>wf1</name>
</web-fragment>wf2
<?xml version="1.0" encoding="UTF-8"?>
<web-fragment id="WebFragment_ID" version="3.1"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd">
<display-name>wf2</display-name>
<name>wf2</name>
</web-fragment>这是两个依赖项的pom块。
<dependency>
<groupId>wf1</groupId>
<artifactId>wf1</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>wf2</groupId>
<artifactId>wf2</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>我认为这个问题存在于web片段文件中。有人能帮我吗?
发布于 2017-05-03 20:02:20
经过多次尝试,我确实发现web片段did中的元素<display>不能出现在两个或多个web片段组件中(在每个<display>中)。在生成web.xml时,不能将标记<displayName>放置两次,从而导致冲突合并。标记<name>是必需的,可以重复多次web-fragment.xml。
https://stackoverflow.com/questions/43749342
复制相似问题