Hello Guys, Can you guys help me out on this?
I don't know if i need to add something to the OSGI configuration. I also cannot find any proper documentation on how to set up oak bundles using OSGI. Thanks in Advance Ciro On Thu, May 19, 2016 at 4:22 AM Marcel Reutegger <[email protected]> wrote: > Hi, > > how do you construct the repository? Maybe something is wrong > with how you use the Jcr or Oak builder and the commit hook > for JCR versioning is missing? > > Regards > Marcel > > On 19/05/16 01:09, "Ciro Santos" wrote: > > >Hello Guys, > > > >I'm working in a project that uses JCR with 2 versions, one using > >jackrabbit and one using OAK. Right now I'm implementing versioning on > >documents. > > > >I was able to make it work using jackrabbit. But when I try to use the > >code > >in the OAK version, I'm getting an error. > > > >We use OSGI to create bundles and the JCR (JackRabbit and OAK) are also > >bundles, which means that we create the OAK repository when starting the > >OSGI felix. Also, the repository is created in the AWS S3. > > > >The odd thing is that we have integration tests that creates a transient > >repository in memory, and it works correctly too. > > > >Here is the creation of the document part of my method: > > > >userSession = > >repository.getUserSession(currentUser.getUserId(),tenantManager.getWorkspa > >ceFromTenant(currentUser.getTenantId())); > > > >folderNode = userSession.getNodeByIdentifier(parentFolderId); > >String documentName = Text.escapeIllegalJcrChars(name); > >final Node fileNode = folderNode.addNode(documentName, > >JcrConstants.NT_FILE); > >final Node contentNode = fileNode.addNode(JcrConstants.JCR_CONTENT, > >JcrConstants.NT_RESOURCE); > >contentNode.addMixin(NodeType.MIX_VERSIONABLE); > >contentNode.setProperty(JcrConstants.JCR_MIMETYPE, mimeType); > > > >try { > > contentNode.setProperty(JcrConstants.JCR_DATA, > >userSession.getValueFactory().createBinary(document)); > >} finally { > > document.close(); > >} > > > >contentNode.setProperty(Property.JCR_LAST_MODIFIED, > >Calendar.getInstance().getTimeInMillis()); > >userSession.save(); > >userSession.getWorkspace().getVersionManager().checkin(contentNode.getPath > >()); > > > >And here is the exception: > > > >Caused by: javax.jcr.nodetype.ConstraintViolationException: > >OakConstraint0021: > >/0/00/00000185-24a6-3bd1-b232-d7ff21f33b6a/home/a/ad/ad50ee6d-60a3-4689-9f > >90-4aa6326a4f45/root/document_to_test_11/jcr:content[[nt:resource, > >mix:versionable]]: Mandatory property jcr:versionHistory not found in a > >new > >node > > at > >org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException( > >CommitFailedException.java:225) > > at > >org.apache.jackrabbit.oak.api.CommitFailedException.asRepositoryException( > >CommitFailedException.java:212) > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.newRepositoryExcept > >ion(SessionDelegate.java:670) > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.save(SessionDelegat > >e.java:496) > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl$8.performVoid(SessionImp > >l.java:419) > > at > >org.apache.jackrabbit.oak.jcr.delegate.SessionDelegate.performVoid(Session > >Delegate.java:274) > > at > >org.apache.jackrabbit.oak.jcr.session.SessionImpl.save(SessionImpl.java:41 > >6) > > at com.hp.ccp.jcr.impl.JCRDAO.addDocument(JCRDAO.java:887) > > ... 99 more > > > >If I add a mixin and save, I already get the error. I dont understand why > >is saying that I dont have this jcr:versionHistory property. > > > >The oak version that we are using is 1.4.0 > > > >Is there anything else to consider? > > > >Could anyone help me out please? I tried some things without success, > >right > >now I don't know how to proccedd. > > > >Thanks in Advance > >Ciro Santos > >
