[ 
https://issues.apache.org/jira/browse/JCR-2745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13140565#comment-13140565
 ] 

Akram BEN AISSI commented on JCR-2745:
--------------------------------------

Hi,
jave you tried to use the ${jboss.home.url} property? I suddenly realized that 
this .url properties are probably intended for this kind of use cases.

                
> Issues configuring repositoryURI or homeDir
> -------------------------------------------
>
>                 Key: JCR-2745
>                 URL: https://issues.apache.org/jira/browse/JCR-2745
>             Project: Jackrabbit Content Repository
>          Issue Type: Bug
>          Components: jackrabbit-core
>    Affects Versions: 2.1.1
>         Environment: Windows 7 64 bit, JBoss 5.1.0.GA, Sun JDK 1.6.0_18
>            Reporter: Sverker Abrahamsson
>
> I've encountered an issue when upgrading jackrabbit to 2.1.1 from 1.x 
> version. Earlier I used to set homeDir parameter to 
> ${jboss.server.data.dir}/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://${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/defaut/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\defult\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\jackrabit\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/sever/default/data/jackrabbit' but does not exists 
> (Installer.java, 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 
> 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 anoying to have to use absoute 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 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

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to