Structures With Duplicate Element Names Fail DDM Verification When Upgrading

This article documents a known issue in which structures with duplicate element names fail Dynamic Data Mapping (DDM) verification when upgrading from Liferay Portal 6.1 to Liferay Portal 6.2 or Liferay Digital Experience Platform 7.0 or 7.1.

For customers who are upgrading their Liferay platform, if you have any Web Content Structures with duplicate element names, you will encounter some issues. This is due to the fact that in Liferay Portal 6.1 it was possible to use duplicate element names in your Web Content Structures, but now it is not.

For example, in Liferay Portal 6.1 you could have the following:

  • Mother name (Text): 
    • Age (Text): 
  • Father name (Text): 
    • Age (Text): 

However, in Liferay Portal 6.2SP6 and upwardsthis structure configuration is no longer possible. Thus, when upgrading to Liferay DXP, if this structure exists it will break the new DDM verification process, and will display an error in the stack trace. Best practice would be to correct all the structures with duplicate names prior to upgrading.

The following shortened stack trace might display this:

20:36:51,758 INFO  [main][VerifyProcess:64] Verifying
INFO - Verifying
20:36:51,759 INFO  [main][LoggingTimer:70] Starting
INFO - Starting
20:36:52,120 INFO  [main][LoggingTimer:38] Completed in 361 ms
INFO - Completed in 361 ms
20:36:52,121 INFO  [main][VerifyProcess:79] Completed verification process in 363ms
INFO - Completed verification process in 363ms
20:36:52,123 ERROR [main][VerifyProcessTracker:221] com.liferay.portal.verify.VerifyException:$MustNotDuplicateFieldName: The field name age cannot be defined more than once
com.liferay.portal.verify.VerifyException:$MustNotDuplicateFieldName: The field name age cannot be defined more than once
        at com.liferay.portal.verify.VerifyProcess.verify(
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker.executeVerifyProcesses(
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker$
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker.executeVerifyProcesses(
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker.execute(
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker$VerifyServiceTrackerMapListener.keyEmitted(
        at com.liferay.portal.verify.extender.internal.VerifyProcessTracker$VerifyServiceTrackerMapListener.keyEmitted(


For Customers Upgrading to Liferay Portal 6.2 SP6 and Higher

If duplicate names exist, this next error appears in the log and the upgrade process stops.

WARN [VerifyDynamicDataMapping:XXX] Structure with class name ID XXXXX and structure
key = XXXXX contains more than one element that is identified by the same name either within itself or within
any of its parent structures. The duplicate element names are: XXX, XXX
ERROR [DBUpgrader:XXX] Unable to execute verify process:
com.liferay.portal.verify.VerifyException: com.liferay.portal.verify.VerifyException: Duplicate element name found in structures
com.liferay.portal.verify.VerifyException: com.liferay.portal.verify.VerifyException: com.liferay.portal.verify.VerifyException:
Duplicate element name found in structures
Stopping the server due to unexpected startup errors

For Customers Upgrading to Liferay DXP 7.0 and 7.1 

19:29:35,298 ERROR [main][VerifyProcessTrackerOSGiCommands:221] com.liferay.portal.verify.VerifyException:$MustNotDuplicateFieldName: The field name page cannot be defined more than once
com.liferay.portal.verify.VerifyException:$MustNotDuplicateFieldName: The field name page cannot be defined more than once


When going over the Checklist for Upgrading to Liferay DXP, users should determine if any duplicate structure names exist and rename all of them prior to running the upgrade script. Considering the previous example above, the best solution would be to rename the two fields with their own unique names, such as mother age and father age

  • Mother name (Text): 
    • Mother Age (Text): 
  • Father name (Text): 
    • Father Age (Text):

The Liferay platform offers a Groovy script that can be executed in the Control Panel > Server Administration tab. This script will help identify any duplicate structure element names that need to be corrected and automatically process the changes. It is specific to legacy Liferay Portal 6.1.

Users should configure this script to reflect their conditions before running it.

Once all the required changes have been made, run the script again in order to verifiy that no more duplicate names are present.

To prepare Web Content, and any other assets using DDM: 

  1. Create a backup of the database and document library.
  2. Navigate to Control Panel > Server Administration > Scripts 
  3. Select Groovy within the drop-down as language and place the contents of the script within the text area.
  4. Run the script once to identify and automatically process affected structures, templates, web content.
  5. Analyze affected templates to determine if there are any references to elements within the structures.
  6. After confirming changes, modify the script, setting the variable _safeMode to false (case-sensitive).
  7. Execute the script a second time.
  8. Once the script has been executed, proceed to manually modify any affected templates (previously determined in step 5 and only if necessary).
  9. Verify that the web content is available and displayed properly.
  10. Proceed to execute any additional portal verification. 

Additional Information

The script requires use of the English (United States) localization. If the portal is in another localization, please perform the following:

  • Set portal localization to English (United States)
  • Execute the groovy script.
  • Revert the localization back.

The script includes other configuration variables:

  • _allLog: If set to true, the script will print additional logging information during the process. By default, this is set to false.
  • _DUPLICATE_FIELD_SUFFIX: This is the string that will be added at the end of every occurrence of a duplicated field name. By default, it is set to Rev.

Once the script has been executed (it can take minutes) please check the server log file looking for NormalizeDuplicateFields traces to see the results. If the log shows this at the end:

INFO  [NormalizeDuplicateFields:?] *** RESULTS ***
INFO  [NormalizeDuplicateFields:?] *** There are no structures with duplicate fields. You can proceed with the upgrade ***
This means that the script did not detect structures with duplicate field names. The upgrade can proceed as normal.

If the script detects structures with duplicate field names, the script will print something like this:

INFO  [NormalizeDuplicateFields] *** RESULTS ***
INFO  [NormalizeDuplicateFields] *** 12 structures with duplicate fields ***
INFO  [NormalizeDuplicateFields] *** 40 templates to modify manually ***
INFO  [NormalizeDuplicateFields] *** 5695 web contents automatically processed ***
INFO  [NormalizeDuplicateFields] *** 79 web contents can not be processed since they were out of sync prior to execute this script ***
INFO  [NormalizeDuplicateFields] *** 3 DDM Structures with duplicate fields automatically processed ***
INFO  [NormalizeDuplicateFields] Finishing NormalizeDuplicateFields process

In these cases, proceed to modify the different objects with duplicate field names.

The script does not cover:

  1. Modification for web contents which were out of sync with its structure prior to executing this script.
  2. Web Content Templates modification. Template content does not follow a predefined pattern so this will need to be performed manually. To aid in this task, please search for the string Template ID within the log to identify the templates which need to be modified.

For example, the script will print out the structures and template ids that are associated with the updated structures:

INFO  [NormalizeDuplicateFields] Checking Structure with ID 2274237 and Structure ID 2274236 and name Companies from group ID 2270225
INFO  [NormalizeDuplicateFields] Field name will be replaced by nameRev1
INFO  [NormalizeDuplicateFields] Field content will be replaced by contentRev1
INFO  [NormalizeDuplicateFields] This structure contains duplicate field names
INFO  [NormalizeDuplicateFields] The following associated templates have to be manually modified:
INFO  [NormalizeDuplicateFields] - Template ID 2274340 from Group ID 2270225
INFO  [NormalizeDuplicateFields] - Template ID 2274400 from Group ID 2270225

Reading this output, this means that the affected structure contained two duplicate fields, name and content. The script will modify the duplicate field name by replacing the second occurrence of name and content with nameRev1 and contentRev1 respectively.

The script will also identify the templates that utilized the newly modified structures. In this example, the template id's 2774340 and 2274400 from Group ID 2270225 used Structure ID 2274237.

At this point, please review the affected templates and verify if the affected field names name; and content were used within the template code. If these field names were used within the template code, please update the template code in order to correctly reference the newly modified element names nameRev1 and contentRev1 to target the correct elements within the structures. In essence, the templates need to be modified, taking into account the new names for the updated fields.

Keep in mind, it is also likely that no modifications are required for the templates if the elementname keyword was not used within the template code.

Various scripts are available for different versions of the portal:

Please also see Upgrading to Liferay Portal 6.2 EE

For more information, please contact Liferay Subscription Services by creating a Help Center ticket.

Was this article helpful?
0 out of 0 found this helpful