I’m not authorized to publish anything; could you give me a project that works ?
Or could you point out the unit test in oak source code, can we use ? Thanks Best regards Da: Alex Parvulescu [mailto:alex.parvule...@gmail.com] Inviato: mercoledì 2 marzo 2016 12:22 A: Oak devs <oak-dev@jackrabbit.apache.org> Oggetto: Re: critical question about oak: db connection Hi, I see you keep having issues with getting a prototype up and running, but pasting the code in emails might be a bit off-putting for anyone looking to give you a hand. Might I suggest publishing the relevant bits (self contained project easy to run and see the error) to a GitHub repository? best, alex On Wed, Mar 2, 2016 at 12:08 PM, Ancona Francesco <francesco.anc...@siav.it<mailto:francesco.anc...@siav.it>> wrote: We are using latest stable oak version In the case i’m sending you we have tried on postgres 9.4 We have simplified the class but now the error is the same we found on Oracle. Class connect to database and write a lot of system rows (system nodes…) but when i create repository there is the error Could you give us a complete example that works on Oracle 12 and Postgres 9.4 ? Is Postgres 9.4 correct version ? Thanks Best regards @Autowired @Qualifier("oakPostgresDataSource") private DataSource ds; @Test public void test() { final DocumentMK.Builder builder = new DocumentMK.Builder(); builder.setBlobStore(createFileSystemBlobStore()); final DocumentNodeStore ns = getRDBDocumentNodeStore(builder); Oak oak = new Oak(ns); Jcr jcr = new Jcr(oak); Repository repo = jcr.createRepository(); Session session = null; try { InputStream is = new ByteArrayInputStream(document_small); session = repo.login(new SimpleCredentials("admin", "admin".toCharArray())); ValueFactory valueFactory = session.getValueFactory(); Binary data = valueFactory.createBinary(is); Node root = session.getRootNode(); root.addNode("hello", NodeType.NT_UNSTRUCTURED); session.save(); // Logout } catch (LoginException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (session != null) session.logout(); ns.dispose(); } } private DocumentNodeStore getRDBDocumentNodeStore(DocumentMK.Builder builder) { DocumentNodeStore ns = null; if (builder == null) { ns = new DocumentMK.Builder().setRDBConnection(ds).getNodeStore(); } else { ns = builder.setRDBConnection(ds).getNodeStore(); } return ns; } private BlobStore createFileSystemBlobStore() { try { FileUtils.deleteDirectory(new File("/var/tmp/oak")); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } FileBlobStore store = new FileBlobStore("/var/tmp/oak"); return store; } [cid:image002.png@01D1747C.2AE9FF00] Francesco Ancona | Software Dev. Dept. (SP) - Software Architect tel. +39 049 8979797<tel:%2B39%20049%208979797> | fax +39 049 8978800<tel:%2B39%20049%208978800> | cel. +39 3299060325<tel:%2B39%203299060325> e-mail: francesco.anc...@siav.it<mailto:francesco.anc...@siav.it> | www.siav.it<http://www.siav.it> I contenuti di questa e-mail e dei suoi allegati sono confidenziali e riservati esclusivamente ai destinatari. L'utilizzo per qualunque fine del presente messaggio e degli allegati così come la relativa divulgazione senza l'autorizzazione del mittente sono vietati. Se avete ricevuto questa e-mail per errore, vi preghiamo di distruggerla e di comunicarcelo. I dati personali sono trattati esclusivamente per le finalità della presente comunicazione in conformità con la legislazione vigente (D.lgs. 196/2003 "Codice Privacy"). Per informazioni: SIAV S.p.A. – s...@siav.it<mailto:s...@siav.it> – 049 8979797 The contents of this e-mail and its attachments are confidential and reserved exclusively to the recipients. The use for any purpose of this message and attachments as well as its disclosure without the consent of the sender is prohibited. If you have received this email in error, please destroy it and notify us. Personal data shall be processed solely for the purposes of this notice in accordance with current legislation (Legislative Decree no. 196/2003 "Code"). For more information: SIAV S.p.A. – s...@siav.it<mailto:s...@siav.it> – 049 8979797 ************************************************************************************ This footnote confirms that this email message has been scanned by PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses. ************************************************************************************