jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sverker Abrahamsson" <sver...@abrahamsson.com>
Subject RE: How to configure jcr-ds.xml with repositoryURI
Date Mon, 13 Sep 2010 11:24:47 GMT
Issue created at https://issues.apache.org/jira/browse/JCR-2745. I did some
more analyzing and found some workarounds:

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 succeeds to instansiate the repository. Webapp still throws exception
"Repository startup configuration is not valid". 

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

Ninth attempt, changing bootstrap-config parameter in web.xml to
${jboss.server.data.dir}/jackrabbit/bootstrap.properties works fine. However
it's annoying to have to use absolute paths in bootstrap.properties 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
bootstrap.properties and setting them as init parameters in web.xml works
fins, then ${jboss.server.data.dir} 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 ${jboss.server.data.dir} 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 available from System.getProperties() but not sure. I believe
this is relevant for other platforms as well.

4. I think there may be necessary 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 analyzed if further.

/Sverker

> -----Original Message-----
> From: Sverker Abrahamsson [mailto:sverker@abrahamsson.com]
> Sent: den 13 september 2010 12:04
> To: users@jackrabbit.apache.org
> Subject: RE: How to configure jcr-ds.xml with repositoryURI
> 
> Hi again
> 
> No answers on my question below but I've done some debugging to figure
> it
> out. 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://${jboss.server.data.dir}/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
> occurs:
> 
> 
> 
> 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/defau
> 
> t/data/jackrabbit' (Installer.java, 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\def
> 
> ult\data\jackrabbit\repository.xml (Installer.java, 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.io.FileNotFoundException:
> :\java\jboss-5.1.0.GA\server\default\data\jackrab
> 
> it\repository.xml (The filename, directory name, or volume label syntax
> is
> incorrect) (Installer.java, 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/se
> 
> ver/default/data/jackrabbit' but does not exists (Installer.java, line
> 160)
> 
> 
> 
> The operating system is Windows 7 and java -version gives:
> 
> java version "1.6.0_18"
> 
> Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
> 
> Java HotSpot(TM) 64-Bit Server VM (build 16.0-b13, mixed mode)
> 
> 
> 
> For the time I can't find any solution for this issue. I'll file a bug
> report.
> 
> /Sverker
> 
> 
> 
> From: Sverker Abrahamsson [mailto:sverker@abrahamsson.com]
> Sent: den 30 augusti 2010 9:51
> To: users@jackrabbit.apache.org
> Subject: How to configure jcr-ds.xml with repositoryURI
> 
> 
> 
> Hi,
> 
> I've been using Jackrabbit on JBoss earlier but when updating to 2.1.1
> I see
> that now I can't use the property homeDir any longer but has to use
> repositoryURI. However, I can't find anywhere how to configure this
> parameter. I used to set homeDir to ${jboss.server.data.dir}/jackrabbit
> for
> the repository to be placed in $JBOSS_HOME/server/default/data, but
> with the
> default repositoryURI (jcr-jackrabbit://jackrabbit) it ends up in
> $JBOSS_HOME/bin/
> 
> 
> 
> How can I place the repository in ${jboss.server.data.dir}?
> 
> 
> 
> Best regards
> 
> Sverker
> 
> 



Mime
View raw message