javax.jcr.ItemExistsException: Same name siblings are not allowed | Community
Skip to main content
vasimakram
Level 4
October 16, 2015
Solved

javax.jcr.ItemExistsException: Same name siblings are not allowed

  • October 16, 2015
  • 6 replies
  • 4063 views

Hi,

I am trying to move pages from one place to another place using seesion. But I am getting javax.jcr.ItemExistsException: Same name siblings are not allowed. 

Below is my code:

String sourcePath = "/content/a/b1";
String destinationPath = "/content/a/b2";

 session.move(sourcePath, destinationPath);
 session.save();

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

Move items in the JCR using the AssetManager API:

https://helpx.adobe.com/experience-manager/using/graniteAPI.html

In this example - we are moving nodes that represent PDF. But it will work for other nodes. 

6 replies

edubey
Level 10
October 16, 2015
  An ItemExistsException is thrown if a property already exists at destination path or a node already exists there and same-name siblings are not allowed.
Adobe Employee
October 16, 2015

Hi,

apologies if I am stating the obvious and you have already checked. But could it be possible that you ran the code once and it was successful, but on subsequent runs you got an exception because the new node had already been created?

Please go to the new target path and delete the new node, "/content/a/b2",  and run you code again.

Regards,

Opkar

edubey
Level 10
October 16, 2015
Its node with same name. Two child node with same name is not allowed under one parent
smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

Move items in the JCR using the AssetManager API:

https://helpx.adobe.com/experience-manager/using/graniteAPI.html

In this example - we are moving nodes that represent PDF. But it will work for other nodes. 

vasimakram
Level 4
October 16, 2015

edubey wrote...

An ItemExistsException is thrown if a property already exists at destination path or a node already exists there and same-name siblings are not allowed.

It doesn't have any common property. What is meant by same name siblings ?

vasimakram
Level 4
October 16, 2015

Using assetManager its working fine.

But while using Session source and destination paths should be as below :

String sourcePath = "/content/a/b1";
String destinationPath = "/content/a/b2/b1"; 

to move b1 under b2 node you should mention b1 node under b2 in destination path.