JSPWiki with JackRabbit#

This is just a recording of activities done to get jspwiki working with the Apache JackRabbit JCR implementation..

When finished, I should make a "Howto set up JSPWiki with JackRabbit".

jspwiki.properties#

I changed the jspwiki.properties:

jspwiki.repository = jackrabbit

Jar bloat ?#

I started running the ContentManager JUnit test, and had to add ever more libraries, I ended up with the following jars that appeared necessary:

  • commons-collections-3.2.1.jar
  • concurrent.jar
  • derby.jar
  • jackrabbit-api-1.4.jar
  • jackrabbit-core-1.4.jar
  • jackrabbit-jcr-commons-1.4.jar
  • jackrabbit-spi-1.4.jar
  • jackrabbit-spi-commons-1.4.jar
  • jackrabbit-text-extractors-1.4.jar
  • lucene-core-2.4.1.jar replacing our old lucene.jar, we should upgrade !

The .classpath(info) file that I ended up with.

A better way, download "bundle" ?#

Download from apache jackrabbit the webapp version, and extract the WEB-INF/lib directory, this contains all the jars you need (and more, but don't use them all).
Also this is version 1.5, that should not have dependencies on tm-extractor.jar anymore.

I used the following from there :

total 6056
-rw-r--r-- 1 metskem metskem  559366 2009-06-28 14:02 commons-collections-3.1.jar
-rw-r--r-- 1 metskem metskem  189284 2009-06-28 14:02 concurrent-1.3.4.jar
-rw-r--r-- 1 metskem metskem 2253277 2009-06-28 14:02 derby-10.5.1.1.jar
-rw-r--r-- 1 metskem metskem   26811 2009-06-28 14:02 jackrabbit-api-1.5.0.jar
-rw-r--r-- 1 metskem metskem 1698241 2009-06-28 14:02 jackrabbit-core-1.5.6.jar
-rw-r--r-- 1 metskem metskem  208144 2009-06-28 14:02 jackrabbit-jcr-commons-1.5.5.jar
-rw-r--r-- 1 metskem metskem   21816 2009-06-28 14:02 jackrabbit-spi-1.5.0.jar
-rw-r--r-- 1 metskem metskem  522850 2009-06-28 14:02 jackrabbit-spi-commons-1.5.5.jar
-rw-r--r-- 1 metskem metskem   33665 2009-06-28 14:02 jackrabbit-text-extractors-1.5.0.jar
-rw-r--r-- 1 metskem metskem  665686 2009-06-28 14:02 lucene-core-2.3.2.jar
I replaced the derby-1.2.1.6 version with the latest stable derby-10.5.1.1 version to solve the issue
java.sql.SQLException: Failed to start database , see the next exception for details.

Print StackTraces in WikiEngine#

To be able to find the root cause of many exceptions, I had to add a couple of extra printStackTraces to WikiEngine, this patch(info) was applied.

Dependency on Lucene TextExtractors#

Some (optional ?) TextExtractor classes missing.
In the end you find javax.jcr.NoSuchWorkspaceException: jspwiki and also several missing extractor classes (like org.apache.jackrabbit.extractor.MsPowerPointTextExtractor)

complete stacktrace/log(info)

JackRabbit configuration#

  • I added a Java System property (-Dorg.apache.jackrabbit.repository.home=/var/jspwiki/jcr) to the tomcat startup script, and started tomcat.
    JackRabbit will generate a default configuration file for you (repository.xml).
  • I moved this file to the /var/jspwiki/jcr directory, and then added another Java System property to the tomcat startup script ((-Dorg.apache.jackrabbit.repository.conf=/var/jspwiki/jcr/repository.xml).
  • I also edited this file and again recycled tomcat.
  • Created directory /var/jspwiki/jcr/workspaces/jspwiki and copied ../default/workspace.xml into it, and changed this file (<Workspace name="jspwiki">)
  • commented out in all workspace.xml (3) files all SearchIndex elements to get rid of the above exceptions nagging about missing extractor classes.

javax.jcr.NamespaceException#

  • the next one is with NameSpaces,:javax.jcr.NamespaceException: failed to register namespace wiki -> http://www.jspwiki.org/ns#: mapping already exists
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
	at org.apache.wiki.util.ClassUtil.getMappedObject(ClassUtil.java:276)
	... 33 more
Caused by: org.apache.wiki.api.WikiException: Failed to initialize the repository content
	at org.apache.wiki.content.ContentManager.<init>(ContentManager.java:278)
	... 38 more
Caused by: javax.jcr.NamespaceException: failed to register namespace wiki -> http://www.jspwiki.org/ns#: mapping already exists
	at org.apache.jackrabbit.core.NamespaceRegistryImpl.registerNamespace(NamespaceRegistryImpl.java:356)
	at org.apache.wiki.content.ContentManager.initialize(ContentManager.java:297)
	at org.apache.wiki.content.ContentManager.<init>(ContentManager.java:274)
	... 38 more

I fixed this with a patch(info) to ContentManager (dunno if it is the right solution)

javax.jcr.AccessDeniedException#

Next one:

Caused by: org.apache.wiki.api.WikiException: Failed to initialize the repository content
	at org.apache.wiki.content.ContentManager.<init>(ContentManager.java:278)
	... 38 more
Caused by: javax.jcr.AccessDeniedException: /pages/Main/jcr:primaryType: not allowed to modify item
	at org.apache.jackrabbit.core.ItemImpl.validateTransientItems(ItemImpl.java:404)
	at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:1058)
	at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:858)
	at org.apache.wiki.content.ContentManager.initialize(ContentManager.java:337)
	at org.apache.wiki.content.ContentManager.<init>(ContentManager.java:274)
	... 38 more

Fixed by passing a dummy SimpleCredential to the repository login, see attached patch(info) (this is a cumulative patch, it incorporates the first patch to ContentManager.

IllegalArgumentException: relPath is not a relative path#

INFO: java.lang.IllegalArgumentException: relPath is not a relative path
	at org.apache.jackrabbit.spi.commons.name.PathFactoryImpl.create(PathFactoryImpl.java:71)
	at org.apache.jackrabbit.core.NodeImpl.resolveRelativeNodePath(NodeImpl.java:224)
	at org.apache.jackrabbit.core.NodeImpl.hasNode(NodeImpl.java:2694)
	at org.apache.wiki.ReferenceManager.initReferenceMetadata(ReferenceManager.java:663)
	at org.apache.wiki.ReferenceManager.initialize(ReferenceManager.java:598)
	at org.apache.wiki.WikiEngine.initialize(WikiEngine.java:616)
	at org.apache.wiki.WikiEngine.<init>(WikiEngine.java:424)
	at org.apache.wiki.WikiEngine.getInstance(WikiEngine.java:357)
	at org.apache.wiki.ui.stripes.WikiRuntimeConfiguration.init(WikiRuntimeConfiguration.java:89)
	at net.sourceforge.stripes.controller.StripesFilter.init(StripesFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:267)

"Fixed" by removing a leading "/" from REFERENCES_ROOT, see attached patch 3(info)

Then another one comes in for RSS:

java.lang.IllegalArgumentException: relPath is not a relative path
	at org.apache.jackrabbit.spi.commons.name.PathFactoryImpl.create(PathFactoryImpl.java:71)
	at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:693)
	at org.apache.jackrabbit.core.NodeImpl.internalAddNode(NodeImpl.java:682)
	at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:2098)
	at org.apache.wiki.content.ContentManager.addPage(ContentManager.java:1381)
	at org.apache.wiki.content.ContentManager.addPage(ContentManager.java:1359)
	at org.apache.wiki.WikiEngine.createPage(WikiEngine.java:1856)
	at org.apache.wiki.rss.RSSGenerator.generate(RSSGenerator.java:317)
	at org.apache.wiki.rss.RSSThread.backgroundTask(RSSThread.java:111)
	at org.apache.wiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:140)
Exception in thread "JSPWiki RSS Generator" org.apache.wiki.InternalWikiException: relPath is not a relative path
	at org.apache.wiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:176)

Removed a few more leading slashes, see attached patch4, this is also a cumulative patch.

RSSGenerator, NullPointerException#

Background thread error: (stack trace follows)
java.lang.NullPointerException
	at org.apache.wiki.rss.RSSGenerator.generateFullWikiRSS(RSSGenerator.java:452)
	at org.apache.wiki.rss.RSSGenerator.generate(RSSGenerator.java:333)
	at org.apache.wiki.rss.RSSThread.backgroundTask(RSSThread.java:111)
	at org.apache.wiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:140)
Exception in thread "JSPWiki RSS Generator" org.apache.wiki.InternalWikiException
	at org.apache.wiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:176)

==> /var/jspwiki/logs/jspwiki.log <==
2009-07-05 14:05:22,658 [JSPWiki RSS Generator] ERROR org.apache.wiki.WikiEngine - Unable to fetch all pages: 
org.apache.wiki.providers.ProviderException: getAllPages()
	at org.apache.wiki.content.ContentManager.getAllPages(ContentManager.java:496)
	at org.apache.wiki.WikiEngine.getRecentChanges(WikiEngine.java:1812)
	at org.apache.wiki.rss.RSSGenerator.generateFullWikiRSS(RSSGenerator.java:448)
	at org.apache.wiki.rss.RSSGenerator.generate(RSSGenerator.java:333)
	at org.apache.wiki.rss.RSSThread.backgroundTask(RSSThread.java:111)
	at org.apache.wiki.util.WikiBackgroundThread.run(WikiBackgroundThread.java:140)
Caused by: javax.jcr.RepositoryException: no search manager configured for this workspace
	at org.apache.jackrabbit.core.WorkspaceImpl.getQueryManager(WorkspaceImpl.java:749)
	at org.apache.wiki.content.ContentManager.getAllPages(ContentManager.java:473)
	... 5 more

left alone for now...

ProviderException: Unable to check for page existence#

INFO: org.apache.wiki.providers.ProviderException: Unable to check for page existence
	at org.apache.wiki.content.ContentManager.pageExists(ContentManager.java:844)
	at org.apache.wiki.JCRWikiPage.isAttachment(JCRWikiPage.java:623)
	at org.apache.wiki.action.ViewActionBean.resolvePage(ViewActionBean.java:171)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.invoke(BeforeAfterMethodInterceptor.java:154)
	at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:129)
	at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
	at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
	at net.sourceforge.stripes.controller.DispatcherHelper.doBindingAndValidation(DispatcherHelper.java:190)
	at net.sourceforge.stripes.tag.UseActionBeanTag.doStartTag(UseActionBeanTag.java:140)
	at org.apache.wiki.jsp.Wiki_jsp._jspService(Unknown Source)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	
	.....
Caused by: javax.jcr.RepositoryException: not an absolute path: pages/Main/HarryPages
	at org.apache.jackrabbit.core.SessionImpl.getItem(SessionImpl.java:815)
	at org.apache.wiki.content.ContentManager.getJCRNode(ContentManager.java:1727)
	at org.apache.wiki.content.ContentManager.pageExists(ContentManager.java:835)
	... 40 more
	

It seems we have to be very careful where to use relative paths and where to use absolute paths.....

Current status#

staring at last error....

Add new attachment

Only authorized users are allowed to upload new attachments.

List of attachments

Kind Attachment Name Size Version Date Modified Author Change note
classpath
.classpath 1.9 kB 1 28-Jul-2009 21:39 Harry Metske
txt
jcr-exception1.txt 40.5 kB 1 28-Jun-2009 15:29 Harry Metske
patch
jcr1.patch 1.4 kB 1 28-Jun-2009 20:01 Harry Metske
patch
jcr2.patch 1.9 kB 1 28-Jun-2009 20:18 Harry Metske
patch
jcr3.patch 0.7 kB 1 05-Jul-2009 14:38 Harry Metske
patch
stacktrace.patch 1.7 kB 1 28-Jun-2009 20:18 Harry Metske
« This page (revision-16) was last changed on 09-Sep-2010 08:00 by 210.94.41.89