• Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.1
    • Fix Version/s: None
    • Component/s: jackrabbit-core
    • Labels:
    • Environment:
      Windows 7 64 bit, JBoss 5.1.0.GA, Sun JDK 1.6.0_18


      I've encountered an issue when upgrading jackrabbit to 2.1.1 from 1.x version. Earlier I used to set homeDir parameter to ${}/jackrabbit for the repository to be placed in $JBOSS_HOME/server/default/data/jackrabbit. I see that homeDir is now deprecated and repositoryURI should be used instead. However, I can't succeed with placing it anywhere else than $JBOSS_HOME/bin/jackrabbit which is where it ends up with repositoryURI = jcr-jackrabbit://jackrabbit

      I've used a debugger and found that the issue occurs in org.apache.jackrabbit.core.RepositoryFactoryImpl.getRepository(Map parameters) where the repository uri is parsed by creating a URI object at line 81 (source code from jackrabbit 2.1.1).

      First attempt, if I set repositoryURI to "jcr-jackrabbit://../server/default/data/jackrabbit" then ".." is interpreted as the authority and "/server/default/data/jackrabbit" as the path, instead of it both as relative path. This doesn't seem to be the right behavior as I can read from jdk javadoc.

      Second attempt, setting repositoryURI to "jcr-jackrabbit://${}/jackrabbit" then that is expanded to "jcr-jackrabbit://D:\java\jboss-5.1.0.GA\server\default\data/jackrabbit" which cause a URISyntaxException with message "Illegal character in authority at index 17".

      Third attempt, setting repositoryURI to "jcr-jackrabbit://D:/java/jboss-5.1.0.GA/server/default/data/jackrabbit" cause D: to be parsed as authority and the rest as path.

      Fourth attempt, using the old depreciated homeDir config parameter the repository is instanciated but the webapp throws exception that repository startup configuration is invalid. It is still creating it's temp directory under ${jboss.home}/bin/jackrabbit/

      Fifth attempt, trying to create repository from webapp. If repository home directory is specified as jackrabbit then it's created under ${jboss.home}/bin/jackrabbit/. If specified as d:/java/jboss-5.1.0.GA/server/default/data/jackrabbit then the following

      11:58:14,220 INFO [STDOUT] 13.09.2010 11:58:14 *INFO * Installer: Creating new repository home ':/java/jboss-5.1.0.GA/server/defaut/data/jackrabbit' (, line 149)
      11:58:14,223 INFO [STDOUT] 13.09.2010 11:58:14 *INFO * Installer: Creating new repository config: :\java\jboss-5.1.0.GA\server\defult\data\jackrabbit\repository.xml (, line 184)
      11:58:14,238 INFO [STDOUT] 13.09.2010 11:58:14 ERROR Installer: Error while installing new repository config ':/java/jboss-5.1.0.GA/server/default/data/jackrabbit/repository.xml': :\java\jboss-5.1.0.GA\server\default\data\jackrabit\repository.xml (The filename, directory name, or volume label syntax is incorrect) (, line 155)
      11:58:25,712 INFO [STDOUT] 13.09.2010 11:58:25 ERROR Installer: Trying to use exisintg repository home ':/java/jboss-5.1.0.GA/sever/default/data/jackrabbit' but does not exists (, line 160)

      Sixth attempt, copying the repository created by webapp from $JBOSS_HOME/bin/jackrabbit to $JBOSS_HOME/server/default/data/jackrabbit cause the webapp still to throw exception that repository startup configuration is invalid

      Seventh attempt, after googling on how URI class works on windows I find a workaround to set repositoryURI to jcr-jackrabbit:/D:/java/jboss-5.1.0.GA/server/default/data/jackrabbit where it suceeds to instansiate the repository. Webapp still throws exception "Repository startup configuration is not valid".

      Eight attempt, debugging shows that RepositoryStartupServlet expects in $JBOSS_HOME/bin/jackrabbit so it's copied there. It does not work to use the macro ${} but using absolute path for repository.home and repository.config works

      Ninth attempt, changing bootstrap-config parameter in web.xml to ${}/jackrabbit/ works fine. However it's anoying to have to use absoute paths in since the jboss macros aren't expanded, neither does repository.config=${rep.home}/repository.xml work.

      Tenth attempt, removing repository.home and repository.config from and setting them as init parameters in web.xml works fins, then ${} is expanded properly. $rep.home} doesn't work for repository.config but that was expected.

      Suggested actions to solve this issue:
      1. Document how to set repositoryURI including the quirk on Windows, I haven't found anything regarding this parameter on jackrabbit website
      2. In org.apache.jackrabbit.core.RepositoryFactoryImpl.getRepository(Map parameters) change line 81 to the following which will solve the issue of \ in path names on windows when ${} is expanded:

      URI uri = new URI(parameter.toString().trim().replaceAll("
      ", "/"));

      3. In org.apache.jackrabbit.j2ee.RepositoryStartupServlet.configure() expand macros when the properties are loaded. I believe the jboss platform properties are availible from System.getProperties() but not sure. I believe this is relevant for other platforms as well.

      4. I think there may be nessary to identify why creating repository from the webapp doesn't work according to the error messages above, I believe this is also and issue with URI but I haven't analysed if further.

      This issue may be related to JCR-2729




            • Assignee:
              sverker Sverker Abrahamsson
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: