I'm trying to get started with the JCR 2.0 " Content Repository Java Technology API Specification" It's really a great document but I miss a minimum of examples to visualize how it is all fits together.
For a start I want to add a pdf-document to my local CRX repository. Form the book I see, that I must add a Node and add the Properties.
File file = new File("/mypath/mydocument.pdf"); FileInputStream is = new FileInputStream(file); ValueFactory valueFactory = session.getValueFactory(); Binary myBinary = valFact.createBinary(is); Value valueFactory =valFact.createValue(myBinary); Node nodeCarl=content.addNode("Carl", "nt:file"); Property pCarl=nodeCarl.setProperty("jcr:data", myBinary);
The program fails with:
javax.jcr.nodetype.ConstraintViolationException: no matching property definition found for {http://www.jcp.org/jcr/1.0}data in the lastt cited line.
I don't know, why this comes up with ..jcr/1.0; The Classpath consists of JCR-2.0.jar and jackrabbit-standalone-2.2.13.jar.
Any hint to get this stored is appreciated.
Ulrich