I am getting the same error message with the current trunk as of today.
Created a new node and added the "mix:versionable" mixable.
fileNode = folderNode.addNode(filename, "nt:file");
if (fileNode.canAddMixin("mix:referenceable"))
fileNode.addMixin("mix:referenceable");
if (fileNode.canAddMixin("mix:versionable"))
fileNode.addMixin("mix:versionable");
// if (fileNode.canAddMixin("mix:simpleVersionable"))
fileNode.addMixin("mix:simpleVersionable");
Error:
org.springframework.web.util.NestedServletException: Request processing
failed; nested exception is javax.jcr.nodetype.ConstraintViolationException:
OakConstraint0021: /documents/versiontest3.jpg[[nt:file, mix:referenceable,
mix:versionable]]: Mandatory property jcr:predecessors not found in a new
node
(However, I don't get the message if I add the "mix:simpleVersionable"
instead, which makes sense though since it does not seem to be implemented
according to https://issues.apache.org/jira/browse/OAK-4166: "As a result,
versioning-related methods invoked on such [simpleVersionable] nodes doesn't
work correctly.)
I looked up the definition:
https://docs.adobe.com/content/docs/en/spec/jcr/2.0/15_Versioning.html
"Under both simple and full versioning, on persist of a new versionable node
N that neither corresponds nor shares with an existing node:
Additionally, under full versioning:
The multi-value REFERENCE property jcr:predecessors of N is initialized to
contain a single identifier, that of V0 (the same as jcr:baseVersion)."
Now I am wondering, should all this (initialization of the jcr:predecessors
property) not be handled by the repository automatically in both cases,
since it knows whether this is a new node etc.? Is it a bug?
I found Jira tickets related to versioning, but they are already three years
old and set to resolved.
https://issues.apache.org/jira/browse/OAK-815
https://issues.apache.org/jira/browse/OAK-1118
Regards,
Mathias
smg11 wrote
> Hi While accessing Jackrabbit oak through deployed Jackrabbit oak web-app
> using rmi, I am getting following error while check in the node to
> repository.
>
> Stack trace:
> Exception in thread "main"
> javax.jcr.nodetype.ConstraintViolationException: OakConstraint0021:
> /testNode_1462713844833[[nt:unstructured, mix:versionable]]: Mandatory
> property jcr:predecessors not found in a new node
> at
> org.apache.jackrabbit.rmi.server.ServerObject.getRepositoryException(ServerObject.java:109)
> at
> org.apache.jackrabbit.rmi.server.ServerSession.save(ServerSession.java:265)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
> at sun.rmi.transport.Transport$1.run(Transport.java:200)
> at sun.rmi.transport.Transport$1.run(Transport.java:197)
> at java.security.AccessController.doPrivileged(Native Method)
> at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
> at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
> at java.security.AccessController.doPrivileged(Native Method)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> at
> sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
> at
> sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:162)
> at org.apache.jackrabbit.rmi.server.ServerSession_Stub.save(Unknown
> Source)
> at
> org.apache.jackrabbit.rmi.client.ClientSession.save(ClientSession.java:272)
> at TestJCRVersionable.main(TestJCRVersionable.java:23)
>
>
>
> Code snippet:
>
> public class TestJCRVersionable {
>
> public static void main(String[] args) throws Exception {
> Repository repository = new
> URLRemoteRepository("http://localhost:8080/oak/rmi");
> Session session = repository.login(new
> SimpleCredentials("admin",
> "admin".toCharArray()));
>
> Node root = session.getRootNode();
> long id=System.currentTimeMillis();
>
> //create versionable node
> Node n = root.addNode("testNode_" + id, "nt:unstructured");
> n.addMixin("mix:versionable");
> session.save();
>
> VersionManager vMgr = session.getWorkspace().getVersionManager();
> vMgr.checkin("/testNode_" + id);
>
> session.logout();
>
> }
>
> }
--
View this message in context:
http://jackrabbit.510166.n4.nabble.com/Mandatory-property-jcr-predecessors-not-found-in-a-new-node-tp4664014p4665901.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.