org.apache.sling.api.resource.PersistenceException: Unable to commit changes to session. | Community
Skip to main content
unai_sarasola
Level 2
October 16, 2015
Solved

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

  • October 16, 2015
  • 3 replies
  • 19327 views

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

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 unai_sarasola

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

3 replies

smacdonald2008
Level 10
October 16, 2015

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. 

unai_sarasola
Level 2
October 16, 2015

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

unai_sarasola
unai_sarasolaAuthorAccepted solution
Level 2
October 16, 2015

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