Torgeir Veimo | 15 Dec 12:30 2014

automatically create unique name among siblings with oak

With oak not supporting SNS anymore I'm looking for a utility method
that ensures unique names for siblings.

Just checking existing siblings and using an incrementing counter is
not sufficient since it wouldn't be cluster or concurrent session
safe, thus might cause an exception later when the session is
persisted. It's also not very performant with a linear search when
there's a large number of siblings.

I can probably get around the cluster issue using a lock, but that
would possibly be even slower.

One approach I'm considering is just using a name like prefix +
sessionId + counter, since I would have control of any writes in that

There's a number of variations of that technique to avoid a linear
search for uniqueness with a large number of siblings: increment
exponentially, using a random number etc.

Does anyone have any existing code that does similar things? I'm
wondering if there's a very simple approach that I've overlooked?



Davide Giannella | 15 Dec 10:06 2014

[ANNOUNCE] Apache Jackrabbit Oak 1.1.3 released

The Apache Jackrabbit community is pleased to announce the release of
Apache Jackrabbit Oak 1.1.3. The release is available for download at:

See the full release notes below for details about this release.

Release Notes -- Apache Jackrabbit Oak -- Version 1.1.3


Jackrabbit Oak is a scalable, high-performance hierarchical content
repository designed for use as the foundation of modern world-class
web sites and other demanding content applications.

Apache Jackrabbit Oak 1.1.3 is an unstable release cut directly from
Jackrabbit Oak trunk, with a focus on new features and other improvements.
For production use we recommend the latest stable 1.0.7 release.

The Oak effort is a part of the Apache Jackrabbit project.
Apache Jackrabbit is a project of the Apache Software Foundation.

Changes in Oak 1.1.3


    [OAK-2270] - Resolve usage of ImmutableTree wrt OSGi constraints
    [OAK-2272] - Compatibility support for pre index rule
(Continue reading)

hsp | 12 Dec 21:03 2014

Bug in restoreBaseVersion 2.8.0


Testing a routine to update a recently property we have added in node of
certain nodetype, I have found that some nodes got a update time value in
jcr:created property.
Digging, I found that the nodes were in repository since it was 1.4 jack
(nowadays already migrated to jack 2.8 repository) and not had the
jcr:createdBy property.
These nodes are with mix:versionable too, and in the call to
versionManager.restore(versionManager.getBaseVersion(node.getPath()), true);
the node was updated in jcr:createdBy (with the user in the session) and in
jcr:created property with the time in that moment.
Well, these nodes were created 2 or 3 years ago, so that is embarrasing to
explain to consumers what could happened with they...

I think it is a bug. The scenario it happens is when a node does not have
the jcr:createdBy property, and in the call to restoreVersion the update in
jcr:created is done.

I wont put the update in production environment before assure that the
jcr:created property will not be modified, or a way to put back the value in
it. But I need to trigger this as soon as possible, due to new features and
some speed in existent routines.

I noticed that posts on this forum seem to be abandoned, I hope to have an
answer in a timely manner

(Continue reading)

Tarek Jarraya | 11 Dec 19:44 2014

Remove version node property change protection

Hi all,

I am using the version 2.8. I want to change the value of a property of
node version located under the jcr:versionStorage. But I am gettibg an
error protected property.

How the disable this protection?

hsp | 11 Dec 18:33 2014

Parameterized default value in property definition

Hi all;In JCR2 spec, says:" Default ValuesThe default values attribute
of a property definition defines the values assigned to property if it is
auto-created. If the property is single-valued this attribute will hold a
single value. If it is multi-valued this attribute will hold an array of
values. /*A default values setting of null indicates that the property does
not have a single static default value. It may have no default value at all
or it may have a parameterized default value defined externally to this
specification.* /If the scoped property is not auto-created then this
attribute has no effect."Like the parte I put in itallic...I need that a
property (single-valued, Long, auto-created) would get value 0 when the node
is nt:folder descendent, and get value 1 when the node is nt:file
descendent. But preferably in creation time done by jackrabbit api (without
must process it by application before save the node...).Is it possible to
define in xml node type definition or such rule must be done by application
in runtime?Regards,Helio

View this message in context:
Sent from the Jackrabbit - Users mailing list archive at
Behrang Saeedzadeh | 2 Dec 10:33 2014

Eager loading nodes and properties when executing a query


I am still searching for potential solutions to avoid the
InvalidItemStateException I discussed in my previous email.

Is there a way to configure Jackrabbit (inside CQ5 using TarPM) to eagerly
load the nodes as well as their properties when executing a query?

For example

    final Session session = resourceResolver.adaptTo(Session.class);
    final QueryManager queryManager =
    final Query query = queryManager.createQuery("", Query.JCR_SQL2);
    final QueryResult queryResult = query.execute();

In the fourth line, I want queryResult to be preloaded with the nodes with
their properties prefetched, so that if while I am iterating through
the returned nodes one or more of them are deleted from the repository or
have the value of their properties changed or properties
deleted if won't affect me or break with IISE exceptions.

Is this possible?

Best regards,
Behrang Saeedzadeh | 2 Dec 06:17 2014

Getting InvalidItemStateException when invoking a simple SQL2 query


In our application, when we execute the following query:

  final String statement = "SELECT * FROM [cq:PageContent] AS sites " +
                           + "WHERE ISDESCENDANTNODE([/content/myapp]) AND
sites.domainName IS NOT NULL "
                           + "ORDER BY sites.domainName";

  final Session session = resourceResolver.adaptTo(Session.class);
    final QueryManager queryManager =
    final Query query = queryManager.createQuery("", Query.JCR_SQL2);
    final QueryResult queryResult = query.execute();

Every now and then it throws this exception pasted into this Gist:

The relevant parts are:

Unable to compare rows:

{ sites: node 297e1b7d-8064-404f-b765-27ba71dff64a }
{ sites: node
(Continue reading)

Behrang Saeedzadeh | 2 Dec 01:39 2014

How to escape dynamically generated String values in a JCR SQL2 query?

Let's pretend I have a JCR 2 query string that is made like this:

String sql2Query = "SELECT * FROM [cq:PageContent] " +
                   "WHERE [aProperty] <> \" + aValue + "\"";

Are there any helper methods using which I can escape aValue?

By the way, I already know that in SQL2 we can use placeholders in queries
and let the framework take care of escaping of values for us, but if I were
to create this query dynamically like this, how can I escape aValueto
prevent SQL injection as well as construction of broken queries?

Thanks in advance.

Best regards,
Ivaylo Kalatchev | 20 Nov 23:29 2014

Memory consumption in JackRabbit 2.9 during workspace.clone()/copy()‏

Hi guys,
I'm evaluating JackRabbit (2.9) for developing a Web Content Management System.
One common scenario would be for end users to create a project (workspace in JCR), make some changes there,
preview, etc. and eventually merge the changes back into the default JCR workspace a few days later. Full versioning.
I'm seeing OutOfMemory errors like below when trying to clone/copy the default workspace. And after
several minutes it fails w/o being able to clone it. Plenty of memory allocated (4GB) to the JVM, noting
else going on there besides this test. The repository itself is not very big, about 100K nodes or so, Oracle
DB used as a back end. The tree is not very flat (less than 100 immediate children per node), 4 levels deep
from the root, each node is 1KB-2KBs in total size, 15 properties or so.
If I change the code to do the workspace clone by copying not the whole tree in one pass but each of the
immediate children of root one by one - it succeeds easily in 5-6 minutes.
Has anyone had good experience with "workspace.copy()" or "workspace.clone()"? How do people usually
create parallel workspaces for concurrent changes in long-lived projects? JCR's workspaces seem like
the obvious choice but issues like these shake my confidence in JackRabbit... And there is no
implementation for deleting work-spaces through the APIs so it doesn't seem to me that people feel the
need for using workspaces that much. Is there a better way to model concurrent projects using JCR (maybe
copying a part of the tree inside of the default workspace and not using multiple workspaces at all?).
As for the OOM errors - I can play with the GC options of the JVM during my evaluation (like
-XX:-UseGCOverheadLimit) to avoid the OOM errors but won't have that luxury in a Production env.
We will have repositories with one to ten million nodes if we reach production with this project. Will
JackRabbit+Oracle backend be up to the task or would Oak+MongoDB be a better choice?
Thx!-------------Exceptions:Exception in thread "jackrabbit-pool-4"
java.lang.OutOfMemoryError: GC overhead limit exceeded	at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.addConditionWaiter(	at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(	at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(	at
java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(	at
java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "jackrabbit-pool-4"
(Continue reading)

mrik009 | 19 Nov 22:23 2014



I am new to Jackrabbit and using it to maintain versioning for collaborative
purposes. Has anyone implemented branching since i have been trying to but
without avail.

1. checkout a node and wait
2. checkout the same node and checkin the node with some changes
3. now try to checkin the node in step 1

Am i doing it wrong.

View this message in context:
Sent from the Jackrabbit - Users mailing list archive at

tessa | 18 Nov 20:45 2014

when will jackrabbit 2.8.1 be released

Are there any plans to release a version of jackrabbit 2.8.1.
I am asking because 2.8.0 was released May 12th, 2014 and there are lots of
oak versions released.
kind regards for any further information

View this message in context:
Sent from the Jackrabbit - Users mailing list archive at