...
Did
...
you
...
get
...
a
...
JCR
...
error?
...
Add
...
it
...
to
...
the
...
list
...
and
...
provide
...
a
...
resolution
...
if
...
you
...
find
...
one.
...
See
...
also
...
...
...
.
Symptom | Environment | Cause | Fix |
---|---|---|---|
Error when activating nodes: |
...
Mag |
...
4.4.8 |
...
EE |
...
Corrupt |
...
versions? |
...
? | |
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
Seen |
...
on |
...
Mag |
...
4.4.6 |
...
CE |
...
but |
...
could |
...
be |
...
any |
...
version |
...
Corrupt |
...
search |
...
index |
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
|
...
Same |
...
error |
...
as |
...
above |
...
" |
...
Index |
...
is |
...
fine, |
...
but |
...
repository |
...
is |
...
corrupt |
...
Tried |
...
configuring |
...
the |
...
persistence |
...
manager |
...
with |
...
all |
...
sorts |
...
of |
...
check |
...
and |
...
auto |
...
repair |
...
flags |
...
( |
...
...
, |
...
...
, |
...
...
, |
...
...
), |
...
but |
...
nothing |
...
helped. |
...
Finally |
...
I |
...
wrote |
...
the |
...
Groovy |
...
script |
...
below |
...
to |
...
remove |
...
corrupt |
...
ChildNodeEntry records. |
What can cause JCR Corruption?
If you have experienced JCR corruption, and can reliably identify the cause, list it here:
Cause | Description |
---|---|
Too many open files. | On linux systems, there is a limit on the number of concurrently open files. When using derby-DB, you have to set this limit high (4096 or more). If you run into the limit during operation, this can cause repo corruption. |
OOM exceptions | If your JVM runs out of memory, you can get repository corruption. |
JVM crashes | If your JVM segfaults, this can cause the repository to become corrupted, as it is not closed properly and write operations may be interrupted. |
This can help other users avoid similar situations in their environment.
Groovy Script to remove invalid child node entries
A JCR node keeps a list of ChildNodeEntries in its State. When you get item does not exist anymore
errors and it is not a broken index (see fix above) then chances are, that a node has a ChildNodeEntry with an invalid UUID. The following script walks trough a JCR tree checking the UUID of each ChildNodeEntry removing the ones pointing to nowhere. In order to use it you will need to
- set the repository
- and the path to the root know from where on down you would like to examine the tree.
- Then uncomment the 4 lines once you are sure that it's doing the right thing. (You can let the script run with the two lines commented to see if invalid ChildNodeEntries are found)
Warning | ||
---|---|---|
| ||
Script is has been modified before placing it on this page and is therefore untested. Maybe a backup would be a good idea. |
Info | ||
---|---|---|
| ||
Currently this script needs the MagnoliaTools installed. Can someone fix this by adding a method to get the current PersistanceManager without the help of external code? |
Code Block |
---|
|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/ChildNodeEntry.html] records.| h3. What can cause JCR Corruption? If you have experienced JCR corruption, and can reliably identify the cause, list it here: || Cause\\ || Description\\ || | Too many open files.\\ | On linux systems, there is a limit on the number of concurrently open files. When using derby-DB, you have to set this limit high (4096 or more). If you run into the limit during operation, this can cause repo corruption. | | OOM exceptions\\ | If your JVM runs out of memory, you can get repository corruption.\\ | | JVM crashes\\ | If your JVM segfaults, this can cause the repository to become corrupted, as it is not closed properly and write operations may be interrupted.\\ | This can help other users avoid similar situations in their environment. h3. Groovy Script to remove invalid child node entries A JCR node keeps a list of [ChildNodeEntries|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/ChildNodeEntry.html] in its [State|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/state/NodeState.html]. When you get {{item does not exist anymore}} errors and it is not a broken index (see fix above) then chances are, that a node has a ChildNodeEntry with an invalid UUID. The following script walks trough a JCR tree checking the UUID of each ChildNodeEntry removing the ones pointing to nowhere. In order to use it you will need to * set the repository * and the path to the root know from where on down you would like to examine the tree. * Then uncomment the 4 lines once you are sure that it's doing the right thing. (You can let the script run with the two lines commented to see if invalid ChildNodeEntries are found) {warning:title=Use at your own risk} Script is has been modified before placing it on this page and is therefore _untested_. *Maybe a backup would be a good idea.* {warning} {info:title=Dependency} Currently this script needs [the MagnoliaTools|http://documentation.magnolia-cms.com/modules/tools.html] installed. Can someone fix this by adding a method to get the current [PersistanceManager|http://jackrabbit.apache.org/api/1.6/org/apache/jackrabbit/core/persistence/PersistenceManager.html] without the help of external code? {info} {code} import info.magnolia.context.*; import info.magnolia.*; import java.util.*; import info.magnolia.tools.*; import org.apache.jackrabbit.core.state.*; // define the repository: reponame = "data"; hm = MgnlContext.getSystemContext().getHierarchyManager(reponame); // configure the root node either by uuid or by path: //node = hm.getContentByUUID("root_node_uuid"); node = hm.getContent("/path/to/root/node"); jcrNode = node.getJCRNode(); // The PersistenceManagerUtil class is part of the MagnoliaTools. Maybe someone can extend the script so that we don't need the class? pm = PersistenceManagerUtil.getPM(jcrNode); checkNode(jcrNode,""); def checkNode(jcrNode, prefix) { println(prefix + jcrNode.getName()); state = pm.load(jcrNode.getNodeId()); cl = new ChangeLog(); childNodeEntries = state.getChildNodeEntries(); for (childNodeEntry in childNodeEntries) { childnode = ContentUtil.getContentByUUID(reponame, childNodeEntry.getId().toString()); if (childnode == null) { println("Subnode missing: " +childNodeEntry.getId().toString()); // uncomment these lines if you want the corrupt child node entries to be deleted /* state.removeChildNodeEntry(childNodeEntry.getId()); state.setStatus(ItemState.STATUS_STALE_MODIFIED); cl.modified(state); pm.store(cl);*/ } else { // to visualize the hierarchy: checkNode(childnode.getJCRNode(),prefix+"...."); } } } {code} |