You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by smg11 <sa...@gmail.com> on 2016/05/08 12:52:47 UTC

Mandatory property jcr:predecessors not found in a new node

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)




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

Re: Mandatory property jcr:predecessors not found in a new node

Posted by mathiasconradt <ma...@gmail.com>.
Hi Chetan,

it’s working now with your fix. Thanks.

- Mathias


> On 20 Dec 2016, at 07:56, chetan mehrotra [via Jackrabbit] <ml...@n4.nabble.com> wrote:
> 
> Hi Mathias, 
> 
> On Tue, Dec 20, 2016 at 1:31 AM, mathiasconradt 
> <[hidden email] <x-msg://8/user/SendEmail.jtp?type=node&node=4665906&i=0>> wrote: 
> > However, the problem DOES NOT occur when I don't use the default repo 
> > configuration but get the session from my own repository configuration 
> 
> Thanks for digging into this. I have opened OAK-5349 for this. Can you 
> try with current trunk and let us know if it works for you? 
> 
> Chetan Mehrotra 
> 
> 
> If you reply to this email, your message will be added to the discussion below:
> http://jackrabbit.510166.n4.nabble.com/Mandatory-property-jcr-predecessors-not-found-in-a-new-node-tp4664014p4665906.html <http://jackrabbit.510166.n4.nabble.com/Mandatory-property-jcr-predecessors-not-found-in-a-new-node-tp4664014p4665906.html>
> To unsubscribe from Mandatory property jcr:predecessors not found in a new node, click here <http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4664014&code=bWF0aGlhcy5jb25yYWR0QGdtYWlsLmNvbXw0NjY0MDE0fC0xMjI2ODM1Nzk=>.
> NAML <http://jackrabbit.510166.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




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

Re: Mandatory property jcr:predecessors not found in a new node

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi Mathias,

On Tue, Dec 20, 2016 at 1:31 AM, mathiasconradt
<ma...@gmail.com> wrote:
> However, the problem DOES NOT occur when I don't use the default repo
> configuration but get the session from my own repository configuration

Thanks for digging into this. I have opened OAK-5349 for this. Can you
try with current trunk and let us know if it works for you?

Chetan Mehrotra

Re: Mandatory property jcr:predecessors not found in a new node

Posted by mathiasconradt <ma...@gmail.com>.
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.

Re: Mandatory property jcr:predecessors not found in a new node

Posted by mathiasconradt <ma...@gmail.com>.
(Sorry for the many mails on this.)

After I added the mix:versionable as described in my previous posting, with
saving the session in between, I am not able to retrieve the history of it,
as I am getting an error as follows:

org.springframework.web.util.NestedServletException: Request processing
failed; nested exception is java.lang.IllegalStateException: Base version
does not exist for /documents/versiontest17.jpg


This is what my node looks like after I created it and added the mixin:

{
  "jcr:created": "Mon Dec 19 2016 20:02:43 GMT+0100",
  "jcr:isCheckedOut": true,
  "jcr:mixinTypes": [
    "mix:referenceable",
    "mix:versionable"
  ],
  "jcr:createdBy": "admin",
  "jcr:uuid": "6481825f-09f0-4639-b166-7bd450cfa836",
  "jcr:primaryType": "nt:file",
  "jcr:content": {
    "jcr:lastModifiedBy": "admin",
    ":jcr:data": 3,
    "jcr:lastModified": "Mon Dec 19 2016 20:02:43 GMT+0100",
    "jcr:uuid": "dd466d5c-0cf8-41da-a86a-c2e7bc3efadd",
    "jcr:primaryType": "nt:resource"
  }
}


From my understanding, the baseVersion should be automatically initialized
when the node is made versionable?!

https://docs.adobe.com/content/docs/en/spec/jcr/2.0/15_Versioning.html

"Additionally, under full versioning: The REFERENCE property jcr:baseVersion
of N is initialized to the identifier of V0. This constitutes a reference
from N to its current base version."




mathiasconradt wrote
> I just noticed, I can add the mix:versionable when I save the session in
> between creating the new node and adding the mixin.
> Not sure if this is supposed to work like this and mandatory to save the
> session first or not.
> 
> So this works:
> 
> Node fileNode = folderNode.addNode(filename, "nt:file");
> session.save();
> fileNode.addMixin("mix:versionable");
> session.save();
> 
> - Mathias
> 
> mathiasconradt wrote
>> 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-tp4664014p4665904.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Mandatory property jcr:predecessors not found in a new node

Posted by mathiasconradt <ma...@gmail.com>.
I just noticed, I can add the mix:versionable when I save the session in
between creating the new node and adding the mixin.
Not sure if this is supposed to work like this and mandatory to save the
session first or not.

So this works:

Node fileNode = folderNode.addNode(filename, "nt:file");
session.save();
fileNode.addMixin("mix:versionable");
session.save();

- Mathias



mathiasconradt wrote
> 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-tp4664014p4665903.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Re: Mandatory property jcr:predecessors not found in a new node

Posted by mathiasconradt <ma...@gmail.com>.
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.