You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-dev@jackrabbit.apache.org by Davide Giannella <gi...@gmail.com> on 2014/02/07 09:51:53 UTC
javax.jcr.nodetype.ConstraintViolationException oak:QueryIndexDefinition
in oak-run
Good morning,
trying to create some benchmarks in oak-run. I'm defining an index
definition with the following snippet in the beforeTest()
index = indexRoot.addNode("testStandardProperty");
index.setProperty("unique", false);
index.setProperty("reindex", false);
index.setProperty("type","property");
index.setProperty("propertyNames", new String[]{INDEXED_PROPERTY});
index.setProperty("jcr:primaryType",
IndexConstants.INDEX_DEFINITIONS_NODE_TYPE);
session.save();
but when executed getting the exception
javax.jcr.nodetype.ConstraintViolationException: No matching property
definition: jcr:primaryType = oak:QueryIndexDefinition
at org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.setProperty(NodeDelegate.java:515)
at org.apache.jackrabbit.oak.jcr.session.NodeImpl$38.perform(NodeImpl.java:1345)
at org.apache.jackrabbit.oak.jcr.session.NodeImpl$38.perform(NodeImpl.java:1334)
at org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:154)
at org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:111)
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.internalSetProperty(NodeImpl.java:1334)
at org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:428)
at org.apache.jackrabbit.oak.benchmark.StardardPropertyIndexOrderByInsertTest.beforeTest(StardardPropertyIndexOrderByInsertTest.java:42)
at org.apache.jackrabbit.oak.benchmark.AbstractTest.execute(AbstractTest.java:271)
at org.apache.jackrabbit.oak.benchmark.BaseOrderByInsertTest.execute(BaseOrderByInsertTest.java:29)
at org.apache.jackrabbit.oak.benchmark.AbstractTest.runTest(AbstractTest.java:157)
at org.apache.jackrabbit.oak.benchmark.AbstractTest.run(AbstractTest.java:138)
at org.apache.jackrabbit.oak.benchmark.BaseOrderByInsertTest.run(BaseOrderByInsertTest.java:29)
at org.apache.jackrabbit.oak.benchmark.BenchmarkRunner.main(BenchmarkRunner.java:198)
at org.apache.jackrabbit.oak.run.Main.main(Main.java:81)
Any hints?
Regards
Davide
Re: javax.jcr.nodetype.ConstraintViolationException
oak:QueryIndexDefinition in oak-run
Posted by Davide Giannella <gi...@gmail.com>.
On Fri, Feb 7, 2014 at 9:58 AM, Alex Parvulescu
<al...@gmail.com> wrote:
> Have you tried using the existing utils class OakIndexUtils? [0]
> See an example here [1].
Thank you. Did the trick.
I think it was missing the intermediate node oak:index but didn't check it.
D.
Re: javax.jcr.nodetype.ConstraintViolationException
oak:QueryIndexDefinition in oak-run
Posted by Alex Parvulescu <al...@gmail.com>.
Hi Davide,
Have you tried using the existing utils class OakIndexUtils? [0]
See an example here [1].
best,
alex
[0]
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/util/OakIndexUtils.java
[1]
https://github.com/apache/jackrabbit-oak/blob/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/SimpleSearchTest.java#L100
On Fri, Feb 7, 2014 at 9:51 AM, Davide Giannella <giannella.davide@gmail.com
> wrote:
> Good morning,
>
> trying to create some benchmarks in oak-run. I'm defining an index
> definition with the following snippet in the beforeTest()
>
> index = indexRoot.addNode("testStandardProperty");
> index.setProperty("unique", false);
> index.setProperty("reindex", false);
> index.setProperty("type","property");
> index.setProperty("propertyNames", new String[]{INDEXED_PROPERTY});
> index.setProperty("jcr:primaryType",
> IndexConstants.INDEX_DEFINITIONS_NODE_TYPE);
> session.save();
>
> but when executed getting the exception
>
> javax.jcr.nodetype.ConstraintViolationException: No matching property
> definition: jcr:primaryType = oak:QueryIndexDefinition
> at
> org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate.setProperty(NodeDelegate.java:515)
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl$38.perform(NodeImpl.java:1345)
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl$38.perform(NodeImpl.java:1334)
> at
> org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.perform(SessionDelegate.java:154)
> at
> org.apache.jackrabbit.oak.jcr.session.ItemImpl.perform(ItemImpl.java:111)
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.internalSetProperty(NodeImpl.java:1334)
> at
> org.apache.jackrabbit.oak.jcr.session.NodeImpl.setProperty(NodeImpl.java:428)
> at
> org.apache.jackrabbit.oak.benchmark.StardardPropertyIndexOrderByInsertTest.beforeTest(StardardPropertyIndexOrderByInsertTest.java:42)
> at
> org.apache.jackrabbit.oak.benchmark.AbstractTest.execute(AbstractTest.java:271)
> at
> org.apache.jackrabbit.oak.benchmark.BaseOrderByInsertTest.execute(BaseOrderByInsertTest.java:29)
> at
> org.apache.jackrabbit.oak.benchmark.AbstractTest.runTest(AbstractTest.java:157)
> at
> org.apache.jackrabbit.oak.benchmark.AbstractTest.run(AbstractTest.java:138)
> at
> org.apache.jackrabbit.oak.benchmark.BaseOrderByInsertTest.run(BaseOrderByInsertTest.java:29)
> at
> org.apache.jackrabbit.oak.benchmark.BenchmarkRunner.main(BenchmarkRunner.java:198)
> at org.apache.jackrabbit.oak.run.Main.main(Main.java:81)
>
> Any hints?
>
> Regards
> Davide
>