1
votes

I am working on AEM 5.6 to 6.2 upgrade project. There are some nodes in aem 5.6 environment which contains invalid character(as per JCR naming convention like rte[2] is one of the node name which doesn't follow the naming convention)but somehow we are able to replicate those nodes in 5.6 environment. After upgrade it to aem 6.2,it seems like JCR is more restricted and won't allow the nodes to replicate if it is having invalid characters. Getting the below error in aem 6.2: error: com.day.cq.replication.ReplicationException: Repository error during node import: Cannot create a new node using a name including an index Is there any way we can configure AEM 6.2 to stop checking JCR node names?or any other solution?

3
Did you tried package installation of same node filters instead of replication?VAr
yes i have tried that also...if we directly install the content package in aem 6.2 then it will skip those nodes which is having invalid jcr names.Arpit
Its because of the oak workspace restriction if (oakName.contains("[")) { throw new RepositoryException("Cannot create a new node using a name including an index"); } and i don't think you can escape this constraint.VAr

3 Answers

1
votes

JCR 2 does not allow [ as a valid character therefore you won't get an easy workaround for this. It's one of the limitations just like the same-named-sibling.

My recommendation will be to modify these nodes before the upgrade/migration to 6.2. This can be complicated and costly for business but 6.2 won't allow it.

As a background [ was allowed in older version due to twisted support for grammar syntax for same-named-siblings.

Assuming that these are all content nodes as nothing out-of-the-box in AEM 5.x follows this naming convention.

Some ways to fix it:

  1. Write a custom servlet to query and rename the paths across all references. You will have to test your content for these renames.
  2. Use Groovy console (https://github.com/OlsonDigital/aem-groovy-console) to rename the nodes.

In either case, you will need to modify the nodes before the migration as the structure is not oak compliant therefore you cannot use crx2oak commit hooks also. This can be done with both in-place upgrade and side-by-side migration. This is similar to the problem with same named siblings that must be corrected before the migration.

Some efficiency techniques that might help:

  1. Write queries to find invalid node names on top-level nodes like /content/mysite-a, /content/mysite-b etc. Don't run root level queries on /content as it might downgrade to traversal and halt the execution.
  2. Ensure that all references are updated in same commit. If you are using custom servlet, call session.save() only after updating all the node names and it's corresponding references.
1
votes

As i mention in the comment this replication failure causes because of the oak workspace restriction as the code snippet below

//handle index if (oakName.contains("[")) { throw new RepositoryException("Cannot create a new node using a name including an index"); }

and i feel you can't escape this constraint as it it required by the repository to maintain consistency

you can find nodes that ends with '[', by below query

SELECT [jcr:path] FROM [nt:base] WHERE ISDESCENDANTNODE('/content/path/') AND [jcr:path] like '%\['

and to modify the JCR/CRX nodes you can use CURL or SlingPostServlet method

Some helpful posts are blow.

https://github.com/paulrohrbeck/aem-links/blob/master/curl_cheatsheet.md http://sling.apache.org/site/manipulating-content-the-slingpostservlet-servletspost.html

0
votes

Can you try migrating using a tool like oak-upgrade and let us know if you are still facing this issue.

The tool is robust and you have the flexibility to configure specific sub-trees for migration using this tool.