---
title: "The display name was defined in multiple fragments with different values includi"
author: "chainhou"
date: "2013-12-06T11:13:26Z"
tags: []
categories: ["编程语言"]
slug: "the-display-name-was-defined-in-multiple-fragments-with-different-values-includi"
draft: false
lastmod: "2013-12-06T11:13:42Z"
id: 1986090
url: "https://chainhou.iteye.com/blog/1986090"
---

在使用Servlet3.0的新特性中关于WebFragment的特性，即将一些功能打包到jar包中，在web-fragment.xml中声明一些Servlet、Filter,如果使用annotation，此处基本不需要什么配置就可以。
将各个功能的jar加到某个Web应用中，该Web应用就具有了jar包中声明的这些功能。

但在使用Eclipse开发的时候，比如新创建了两个Web Fragment Project,并将其加到某个Web应用中，此时部署到Web容器中会产生如下异常信息

```java
The display name was defined in multiple fragments with different values including fragment with name [xxx]
```


但只添加一个fragment则没有问题。经过仔细查看，原来是因为两个fragment的项目配置文件web-fragment.xml，在Eclipse创建工程的时都自动生成了display这个标签，但每个web-fragment.xml中的东西又都会被统一解析，因此导致display元素定义重复了。

因此，解决该问题，只需要将web-fragment.xml中的display删除即可。