jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edgar Poce <edgarp...@gmail.com>
Subject Re: problem with non-synchronized repository instances
Date Fri, 25 Mar 2005 04:12:16 GMT
Hi brian

Brian Moseley wrote:
 > for the repository config, i'm using the repository.xml that comes with
 > jackrabbit (maybe from the first-steps example?), with LocalFilesystem
 > insteaad of CQFileSystem and XMLPersistenceManager rather than
 > ObjectPersistenceManager.
 >
If two jackrabbit instances, or any other application, try to access a 
local file resource simultaneously I think it will cause IO exceptions.

> in each webapp, i use a Spring factory bean to instantiate 
> RepositoryImpl. the instances are configured identically (same config 
> file path, same repository home dir).
To prevent the above situation you should try to create only one 
instance and share it across all the webapps. You can do it through JNDI 
(see configuration example below). See Model 2 at 
http://incubator.apache.org/jackrabbit/arch/deploy.html.

>   1) i establish a repository session in the webui webapp and create a 
> node of type "nt:folder" at /test (representing user the homedir of a 
> user named test)
> 
>   2) i then make a GET request with my browser to the webdav app to view 
> the root of the repository, and the only child node i see in the listing 
> is jcr:system.
> 
I guess that's the expected behaviour. I think jackrabbit caches the 
nodes' states and if one instance is unaware of the other's activity ...

> how can this be explained? is this not an envisioned way of using 
> jackrabbit? doesn't that architecture graphic on the jackrabbit site 
> specifically indicate that multiple webapps should be able to access the 
> same repository?
I think  a "shared J2EE Resource" means one instance for multiple apps 
and not one persistent storage for multiple jackrabbit instances.
In model 1, "The (Web-) Application Bundle", each instance has its own 
persistence storage and don't share anything.

A model 2 configuration example for Tomcat 4.x (see tomcat docs):
------
in server.xml:
   <Resource
	name="jcr/repositoryFactory"
	auth="Container"
	type="org.apache.jackrabbit.core.jndi.BindableRepository"/>
   <ResourceParams name="jcr/repositoryFactory">
     <parameter>
       <name>factory</name>
<value>org.apache.jackrabbit.core.jndi.BindableRepositoryFactory</value>
     </parameter>
     <parameter>
       <name>configFilePath</name>
<value>C:\eclipse\workspace\JCRTags\src\examples\web\WEB-INF\repository\repository.xml</value>
     </parameter>
     <parameter>
       <name>repHomeDir</name>
<value>C:\eclipse\workspace\JCRTags\src\examples\web\WEB-INF\repository</value>
     </parameter>
   </ResourceParams>

--------
in web.xml:
	<!--  Default repository -->
	<resource-env-ref>
		<description>
			Jackrabbit repository factory
		</description>
		<resource-env-ref-name>
			jcr/repositoryFactory
		</resource-env-ref-name>
		<resource-env-ref-type>
			org.apache.jackrabbit.core.jndi.BindableRepository
		</resource-env-ref-type>
	</resource-env-ref>

------
java code to get the repo:
   InitialContext ctx = new InitialContext();
   Context env = (Context) ctx.lookup("java:comp/env");
   Repository repo = (Repository) env.lookup("jcr/repositoryFactory");

regards
edgar

Mime
View raw message