After doing some further debugging, I found something interesting. But since
I'm new to Oak and just getting started, I don't know what to make of it
yet.

The initial problem

org.springframework.web.util.NestedServletException: Request processing
failed; nested exception is javax.jcr.nodetype.ConstraintViolationException:
OakConstraint0021: /documents/versiontest41.jpg[[nt:file, mix:referenceable,
mix:versionable]]: Mandatory property jcr:predecessors not found in a new
node

ONLY occurs when I use the default repository as it is configured in the
oak-standalone app
(https://github.com/apache/jackrabbit-oak/tree/trunk/oak-examples/standalone).
This is interesting, because the OP of this thread also referred to the
oak-examples webapp (I'm using the standalone app, but still...).

However, the problem DOES NOT occur when I don't use the default repo
configuration but get the session from my own repository configuration (but
using the same code/method for creating the node and adding the mixin).


    // 1. get the session from the default repository configured in
Oak-Standalone by default (but with --mongo) => versionable mixin does not
work
    private Session getRepositorySession1() throws Exception {
        Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()), "default");
        return session;
    }

    // 2. get the session from my hardcoded configuration, which is as below
in the method. => versionable mixin works fine
    private Session getRepositorySession2() throws Exception {
        Repository repo;
        DocumentNodeStore nodeStore;
        DB db;
        db = new MongoClient("localhost", 27017).getDB("test5");
        nodeStore = new DocumentMK.Builder().setMongoDB(db).getNodeStore();
        repo = new Jcr(nodeStore).withAsyncIndexing().createRepository();
        Session session = repo.login(new SimpleCredentials("admin",
"admin".toCharArray()), "default");
        return session;
    }

Regards,
Mathias



--
View this message in context: 
http://jackrabbit.510166.n4.nabble.com/Mandatory-property-jcr-predecessors-not-found-in-a-new-node-tp4664014p4665905.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Reply via email to