Expand my Community achievements bar.

SOLVED

org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.

Avatar

Level 2

I'm having the following exception: org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session.

when I try to make commit to a ResourceResolver. 

It's only happening to me in a new machine where I'm migrating my tools, in the older It works fine with the same packages. Do you know what can be happening?

 

Thank you

1 Accepted Solution

Avatar

Correct answer by
Level 2

Finally I found the solution.

The problem was that the blueprint contain in some of the elements the jcr:uuid created. As this have to be unique, when the code replicate the page It also copy the uuid and that broke the constraint of Oak that having unique uuids

View solution in original post

3 Replies

Avatar

Level 10

If a save is working on machine A and not on Machine B - there is an environment setting that is different that accounts for this difference (this setting is making the resource read-only - no modifications). It can be a few things: 

1 - does the user have permission to save node? 

2 - is the node in the JCR at the same location? 

Can you try and save as admin and see if that works? i suspect it may be a permission issue. 

Avatar

Level 2

Hi,

Yes, I'm logged as admin and I can create sites, etc, with my current permissions.

The JCR is at the same location,

I think is something related with the environment, looking into the stack trace I found this:

Caused by: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0030: Uniqueness constraint violated at path [/] for one of the property in [jcr:uuid] having value e3e76b1d-0ada-42a7-b51c-2130e5b4c0ae 

Caused by: javax.jcr.nodetype.ConstraintViolationException: OakConstraint0030: Uniqueness constraint violated at path [/] for one of the property in [jcr:uuid] having value e3e76b1d-0ada-42a7-b51c-2130e5b4c0ae

                at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:225)

                at org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:212)

                at 

Thank you

Avatar

Correct answer by
Level 2

Finally I found the solution.

The problem was that the blueprint contain in some of the elements the jcr:uuid created. As this have to be unique, when the code replicate the page It also copy the uuid and that broke the constraint of Oak that having unique uuids