Error: Global element declaration/definition of name are duplicated at the following locations

Sometimes, your composite suddenly stopped working after you’ve started referring to a new xsd file – via a service/reference/component.

Your composite was getting deployed properly, and suddenly after few changes, it gets the following error

Error: Global element declaration/definition of name ‘{http://www.example.org}part1′are duplicated at the following locations:

OR

Error(80): query “/ns2:part1/ns2:firstName” is invalid, because Global element declaration/definition of 
name ‘{http://www.example.org}part1′are duplicated at the following locations:
Sometimes, you get this error when your composite is working with more than one schema(xsd) files.
Reason for this is that if both the partname and the namespace are exactly same, then their definitions also have to be exactly same.
A simple scenario would be, if you are using one xsd in your composite and there is an other xsd being referred by one of the components/services/references in your composite. And lets say that both the xsd’s have the same part name. In such cases, both the parts have to be exaclty same, even annotations in that part.
For example, in this composite, this is the xsd being used
 
And lets say one of the references/services in the composite is either using/referring to an xsd as below

 

If you observe these two schemas, and the corresponding source,
Both are having the same namespace as well as the part names(part1 in this case). But second xsd is having a different annotation
Thumb rule is that when the namespaces are the same and the part names are same, then the definitions for those parts across the xsd’s should be exacly same.
Resolution to this is that, if you change the annotation of second xsd from “A sample element1” to “A sample element”, the issue gets resolved.

 Hope this helps you. Cheers.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s