jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Pietsch <mpe...@gmx.de>
Subject Re: Webdav access using the same repository as the applicationContext bean [solved]
Date Thu, 14 Aug 2008 12:33:54 GMT
Hi Alex,

your suggestion hit the mark -- Thank you!

Again for everybody else: The problem was that there were two instances 
of the repository (one for the springmodules WebDAVServlet and one for 
the Spring Bean and I was not able to configure the WebDAVServlet to use 
the Spring Bean defined in the applicationContext.xml. Using RMI for 
that connection seemed to be overkill since I do not want to share the 
repository across different machines. Nor JNDI worked since I was not 
able to register the  Spring bean via JNDI from within the 


With the following lines in the Spring's applicationContext.xml you can 
register the repository as a servlet context attribute (which was that 
little piece of information I needed ;-)):


     <property name="attributes">
             <entry key="javax.jcr.Repository" value-ref="repository"/>


Then you can get rid of (need not to define) the 
RepositoryStartupServlet since you already started the servlet in the 
Spring's applicationContext.xml. The RepositoryAccessServlet will then 
look for the "javax.jcr.Repository" attribute in the servlet context 
(and find it). The rest of the configuration remains unchanged.



         If this is set, the RepositoryAccessServlet expects a
         Repository in the ServletContext attribute having this name.
         This allows servlets of this module to be used with
         repositories intialized by the jackrabbit-jcr-servlet module



Thanks for your help, Alex!


Alexander Klimetschek schrieb:
> What you probably want is to have the repository (of which there
> should be only one instance in your server) handled by Spring and
> provide access to it via the webdav servlets. The "repository" bean
> gives you a single repository already. Now you should turn of the
> RepositoryStartupServlet, which tries to start another repository (all
> the servlets in your current config have no knowledge about the Spring
> config) with the same settings (repository.xml and home directory). To
> access the repository created by Spring, you can put the the
> repository instance returned from the RepositoryFactoryBean
> "repository" into the servlet context attribute
> "javax.jcr.Repository". This way the RepositoryAccessServlet finds
> them (you can configure the name of the context attribute in the
> servlet config for this servlet).
> Regards,
> Alex
> On Thu, Jul 31, 2008 at 1:36 AM, Martin Pietsch <mpeach@gmx.de> wrote:
>> Hi,
>> i am using Appfuse (Spring 2.5) and tried to set up a Jackrabbit
>> repository which should be available as a bean in the
>> applicationContext. I used springmodules and the following configuration
>> in the applicationContext.xml:
>> <bean id="repository"
>> class="org.springmodules.jcr.jackrabbit.RepositoryFactoryBean">
>> <property name="configuration" value="/WEB-INF/repository.xml" />
>> <property name="homeDir" value="/tmp/repo"/> </bean>
>> <bean id="jcrSessionFactory"
>> class="org.springmodules.jcr.jackrabbit.JackrabbitSessionFactory">
>> <property name="repository" ref="repository" /> </bean>
>> <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>> <property name="sessionFactory" ref="jcrSessionFactory" /> <property
>> name="allowCreate" value="true" /> </bean>
>> Exactly the same repository should be available via WebDAV to store
>> files on it. Thus I tried to set up the Jackrabbit WebDavServlet
>> (web.xml) without success. It just gives me an empty page but no error
>> messages / exceptions. Thus it seems not to be connected to the
>> repository. I think my repository.xml is OK so far because I am able to
>> store data in the repository via the bean.
>> Has anyone configuration suggestions for that purpose? On the web I've
>> found examples for Spring integration as well as for WebDAV access, but
>> not for both of them working together.
>> I know the description of my error is vague, but I think my concern is
>> clear.
>> Find below the relevant part of the web.xml.
>> Thanks in advance,
>> Martin

View raw message