You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by zhouxu <zh...@docworks.cn> on 2019/05/09 11:29:55 UTC

Failure to do anything,throw CommitFailedException: OakMerge0004

Hello expert:

  1. To use Oak in my project simply add a dependency to
org.apache.jackrabbit:oak-jcr:1.10.2 and to javax.jcr:jcr:2.0。

  2. we construct a Repository instance,use mongodb like this:
     MongoClient 
mongoClient=getMongoClient(mongodbIP,mongodbPort,dbName,userName,password);
     DocumentNodeStore documentNodeStore =
newMongoDocumentNodeStoreBuilder()
     .setMongoDB(mongoClient, dbName, 0)
     .setBlobStore(new FileBlobStore("D:\\amberdata
FileStore"))
      .build();

    Repository repository = new Jcr(new
Oak(documentNodeStore)).createRepository();

 3.Every developer uses the oak of a local application to connect to the
same mongodb,

A few days later,We failed to unregister node type dw_unit_detail which we
registered,it takes a long time,and throw CommitFailedException:
OakMerge0004,like this:

    javax.jcr.InvalidItemStateException: Failed to unregister node type
dw_unit_detail

at
org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:240)
at
org.apache.jackrabbit.oak.plugins.nodetype.write.ReadWriteNodeTypeManager.unregisterNodeType(ReadWriteNodeTypeManager.java:186)
at com.datamber.afc.domain.type.AfType.destroy(AfType.java:397)
at com.datamber.afc.domain.type.AfTypeTest.destroy(AfTypeTest.java:345)
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
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at
com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at
com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at
com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.jackrabbit.oak.api.CommitFailedException:
OakMerge0004: OakMerge0004: Following exceptions occurred during the bulk
update operations:
[org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
3:/jcr:system/jcr:nodeTypes/dw_customize_type was changed in revision
r16a0699ff58-0-3 (not yet visible), which was applied after the base
revision
r16a0b08f9b6-0-1,r16a067a0c76-0-2,r16a0699faf1-0-3,r16a072d9ee8-0-4,r16a069a45a1-0-5,r16a06874e87-0-6,r16a069be50a-0-7,r16a073313ba-0-8,r16a073e63ae-0-9,r16a0769307d-0-a,r16a0ae97b21-0-b,r16a0a0b1912-0-c,r16a0a0fa4e7-0-d,r16a0a4bbc67-0-e,r16a0a4438fc-0-f,r16a0ae19945-0-10,
before
r16a0b099334-0-1] (retries 5, 303136 ms)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:218)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge(DocumentNodeStoreBranch.java:127)
at
org.apache.jackrabbit.oak.plugins.document.DocumentRootBuilder.merge(DocumentRootBuilder.java:170)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.merge(DocumentNodeStore.java:1848)
at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:250)
at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:261)
at
org.apache.jackrabbit.oak.plugins.nodetype.write.ReadWriteNodeTypeManager.unregisterNodeType(ReadWriteNodeTypeManager.java:182)
... 26 more
Caused by: org.apache.jackrabbit.oak.plugins.document.ConflictException:
Following exceptions occurred during the bulk update operations:
[org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
3:/jcr:system/jcr:nodeTypes/dw_customize_type was changed in revision
r16a0699ff58-0-3 (not yet visible), which was applied after the base
revision
r16a0b08f9b6-0-1,r16a067a0c76-0-2,r16a0699faf1-0-3,r16a072d9ee8-0-4,r16a069a45a1-0-5,r16a06874e87-0-6,r16a069be50a-0-7,r16a073313ba-0-8,r16a073e63ae-0-9,r16a0769307d-0-a,r16a0ae97b21-0-b,r16a0a0b1912-0-c,r16a0a0fa4e7-0-d,r16a0a4bbc67-0-e,r16a0a4438fc-0-f,r16a0ae19945-0-10,
before
r16a0b099334-0-1]
at
org.apache.jackrabbit.oak.plugins.document.Commit.checkConflicts(Commit.java:632)
at
org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:333)
at
org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:252)
at
org.apache.jackrabbit.oak.plugins.document.Commit.applyInternal(Commit.java:220)
at org.apache.jackrabbit.oak.plugins.document.Commit.apply(Commit.java:208)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:310)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:275)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.access$500(DocumentNodeStoreBranch.java:55)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$InMemory.merge(DocumentNodeStoreBranch.java:531)
at
org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:194)
... 32 more



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html

Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by zhouxu <zh...@docworks.cn>.
Thank you very much!
The OakMerge0004 exception has been handled in your way!
Are you familiar with oak solr?



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html

Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

On 14.05.19, 17:21, "zhouxu" <zh...@docworks.cn> wrote:
> When used in OSGi environment then various Oak components can be
> configured using OSGi Configuration Support.
> can you give me some message or reference link about "Repository OSGi
> Configuration" except sling?

Do you mean how to configure the DocumentNodeStoreService as
described here?

https://jackrabbit.apache.org/oak/docs/osgi_config.html

I'm somewhat familiar with Apache Sling, which is why I referred to
that project. But there are probably other ways to deal with
OGSi configurations, even directly with the OSGi configuration
admin API. Though, I still think Apache Sling does that in a
rather convenient way, e.g. with the OSGi Installer it provides:

https://sling.apache.org/documentation/bundles/osgi-installer.html

Regards
 Marcel


Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by zhouxu <zh...@docworks.cn>.
When used in OSGi environment then various Oak components can be configured
using OSGi Configuration Support.
can you give me some message or reference link about "Repository OSGi
Configuration" except sling?



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html

Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

On 14.05.19, 13:19, "zhouxu" <zh...@docworks.cn> wrote:
> We have used oak API and JCR API to develop business functions. If we
> use Apache Sling, will the completed business functions have an impact?

Not necessarily. You can still use the Oak and JCR API with Apache Sling.
There may be some impact when you move from a traditional web application
model to an OSGi component based application.

Regards
 Marcel


Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by zhouxu <zh...@docworks.cn>.
Thanks for your reply! 
We have used oak API and JCR API to develop business functions. If we use
Apache Sling, will the completed business functions have an impact?



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html

Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

See my message in OAK-8221 [0] and the source code of
DocumentNodeStoreService for additional periodic tasks
that need to run.

Though, running Oak as a web application is probably easiest
with Apache Sling [1] and a OSGi container. That way you can
use the DocumentNodeStoreService and don't have to take
care of those additional tasks manually.

Regards
 Marcel

[0] https://issues.apache.org/jira/browse/OAK-8221?focusedCommentId=16815250&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-16815250
[1] https://sling.apache.org/

On 13.05.19, 13:26, "zhouxu" <zh...@docworks.cn> wrote:

    Yes,I donot know how to use DocumentNodeStoreService in our web
    application,can you give some usefull message or code,thanks!
    
    
    
    --
    Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html
    


Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by zhouxu <zh...@docworks.cn>.
Yes,I donot know how to use DocumentNodeStoreService in our web
application,can you give some usefull message or code,thanks!



--
Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html

Re: Failure to do anything,throw CommitFailedException: OakMerge0004

Posted by Marcel Reutegger <mr...@adobe.com>.
Hi,

it looks like this is the same as reported already in OAK-8221 [0]. See my comments
in that issue how to prevent and resolve this situation.

Regards
 Marcel

[0] https://issues.apache.org/jira/browse/OAK-8221

On 09.05.19, 16:16, "zhouxu" <zh...@docworks.cn> wrote:

    Hello expert:
    
      1. To use Oak in my project simply add a dependency to
    org.apache.jackrabbit:oak-jcr:1.10.2 and to javax.jcr:jcr:2.0。
    
      2. we construct a Repository instance,use mongodb like this:
         MongoClient 
    mongoClient=getMongoClient(mongodbIP,mongodbPort,dbName,userName,password);
         DocumentNodeStore documentNodeStore =
    newMongoDocumentNodeStoreBuilder()
         .setMongoDB(mongoClient, dbName, 0)
         .setBlobStore(new FileBlobStore("D:\\amberdata
    FileStore"))
          .build();
    
        Repository repository = new Jcr(new
    Oak(documentNodeStore)).createRepository();
    
     3.Every developer uses the oak of a local application to connect to the
    same mongodb,
    
    A few days later,We failed to unregister node type dw_unit_detail which we
    registered,it takes a long time,and throw CommitFailedException:
    OakMerge0004,like this:
    
        javax.jcr.InvalidItemStateException: Failed to unregister node type
    dw_unit_detail
    
    at
    org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException(CommitFailedException.java:240)
    at
    org.apache.jackrabbit.oak.plugins.nodetype.write.ReadWriteNodeTypeManager.unregisterNodeType(ReadWriteNodeTypeManager.java:186)
    at com.datamber.afc.domain.type.AfType.destroy(AfType.java:397)
    at com.datamber.afc.domain.type.AfTypeTest.destroy(AfTypeTest.java:345)
    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
    org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at
    org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at
    org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at
    org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at
    org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at
    org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at
    org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at
    org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    at
    com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    at
    com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    at
    com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: org.apache.jackrabbit.oak.api.CommitFailedException:
    OakMerge0004: OakMerge0004: Following exceptions occurred during the bulk
    update operations:
    [org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
    3:/jcr:system/jcr:nodeTypes/dw_customize_type was changed in revision
    r16a0699ff58-0-3 (not yet visible), which was applied after the base
    revision
    r16a0b08f9b6-0-1,r16a067a0c76-0-2,r16a0699faf1-0-3,r16a072d9ee8-0-4,r16a069a45a1-0-5,r16a06874e87-0-6,r16a069be50a-0-7,r16a073313ba-0-8,r16a073e63ae-0-9,r16a0769307d-0-a,r16a0ae97b21-0-b,r16a0a0b1912-0-c,r16a0a0fa4e7-0-d,r16a0a4bbc67-0-e,r16a0a4438fc-0-f,r16a0ae19945-0-10,
    before
    r16a0b099334-0-1] (retries 5, 303136 ms)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:218)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge(DocumentNodeStoreBranch.java:127)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentRootBuilder.merge(DocumentRootBuilder.java:170)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore.merge(DocumentNodeStore.java:1848)
    at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:250)
    at org.apache.jackrabbit.oak.core.MutableRoot.commit(MutableRoot.java:261)
    at
    org.apache.jackrabbit.oak.plugins.nodetype.write.ReadWriteNodeTypeManager.unregisterNodeType(ReadWriteNodeTypeManager.java:182)
    ... 26 more
    Caused by: org.apache.jackrabbit.oak.plugins.document.ConflictException:
    Following exceptions occurred during the bulk update operations:
    [org.apache.jackrabbit.oak.plugins.document.ConflictException: The node
    3:/jcr:system/jcr:nodeTypes/dw_customize_type was changed in revision
    r16a0699ff58-0-3 (not yet visible), which was applied after the base
    revision
    r16a0b08f9b6-0-1,r16a067a0c76-0-2,r16a0699faf1-0-3,r16a072d9ee8-0-4,r16a069a45a1-0-5,r16a06874e87-0-6,r16a069be50a-0-7,r16a073313ba-0-8,r16a073e63ae-0-9,r16a0769307d-0-a,r16a0ae97b21-0-b,r16a0a0b1912-0-c,r16a0a0fa4e7-0-d,r16a0a4bbc67-0-e,r16a0a4438fc-0-f,r16a0ae19945-0-10,
    before
    r16a0b099334-0-1]
    at
    org.apache.jackrabbit.oak.plugins.document.Commit.checkConflicts(Commit.java:632)
    at
    org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:333)
    at
    org.apache.jackrabbit.oak.plugins.document.Commit.applyToDocumentStore(Commit.java:252)
    at
    org.apache.jackrabbit.oak.plugins.document.Commit.applyInternal(Commit.java:220)
    at org.apache.jackrabbit.oak.plugins.document.Commit.apply(Commit.java:208)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:310)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.persist(DocumentNodeStoreBranch.java:275)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.access$500(DocumentNodeStoreBranch.java:55)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch$InMemory.merge(DocumentNodeStoreBranch.java:531)
    at
    org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreBranch.merge0(DocumentNodeStoreBranch.java:194)
    ... 32 more
    
    
    
    --
    Sent from: http://jackrabbit.510166.n4.nabble.com/Jackrabbit-Dev-f523400.html