Apache Jackrabbit Questions and Answers
New to Jackrabbit
See the Official Jackrabbit FAQ.
Please ask questions on the Jackrabbit mailing lists. Use the users list for questions around using JCR and Jackrabbit. Use the dev list for the development of Jackrabbit itself.
When reporting problems, please provide:
- The error message and stack trace (including all root causes; see also the log file if there are more exceptions)
- The configuration (repository.xml and all workspace.xml files).
- The versions of the Jackrabbit jar files you use (the list of all jar file names).
If you are sure it's a bug, please create a new issue in Jira. If possible, bug reports should also include a simple, standalone test case that reproduces the problem. It would be great if the test case does not have any dependencies except Jackrabbit and can be run using the main(String... args) method. Please include any initialization code in the Java class.
Mailing List Archives
The mailing list archives contain a lot of knowledge around JCR and Jackrabbit:
- http://www.nabble.com/Jackrabbit-f361.html (allows to post using a Nabble account instead of subscribing to the lists)
- http://jackrabbit.markmail.org/ (nice user interface)
- http://dev.day.com/discussion-groups/lists.html (search also across the Apache Sling list and Day's commercial repository CRX)
A very nice site for programming questions is Stackoverflow, which also has some questions about JCR and Jackrabbit.
Frequently Asked Questions
Q: How do I store monetary values?
A: For JCR 1.0, use string, or multiply by 100 and use long. For JCR 2.0, use decimal. Using double is not recommended, because of rounding problems : Java Ranch Java Practices.
The JCR specification explicitly states that a Session is not thread-safe (JCR 1.0 section 7.5 and JCR 2.0 section 4.1.2). Hence, Jackrabbit does not support multiple threads concurrently reading from or writing to the same session. Each session should only ever be accessed from one thread.
Multiple sessions however can read from the same repository concurrently.
Also, multiple sessions can write to the repository concurrently, given that they write to different nodes. Internally, Jackrabbit stores the list of child nodes at the node itself. Still, concurrently adding, moving, or deleting child nodes of the same node is supported (changes are merged), when using different node names. Concurrently adding, moving, or deleting same name siblings is not supported and may throw an exception.
If you need to write to the same node concurrently, then you need to use multiple sessions, and use JCR locking to ensure there is no conflict.