我试图在我的网络应用程序中使用两个网络片段,在部署时我收到以下错误:
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-fragment.xml 的名称和显示标签值,但错误仍然存在。当我在我的 pom 中只使用一个网络片段时,它工作正常。
这是两个网络片段: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-fragment.xml 中。有人可以帮助我吗?