You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sergey Podatelev <br...@gmail.com> on 2009/12/11 10:51:54 UTC

Re: FreeBSD indexing and lock file issues

On Mon, Nov 16, 2009 at 4:07 PM, Alexander Klimetschek <ak...@day.com> wrote:
> On Mon, Nov 16, 2009 at 11:56, Sergey Podatelev
> <br...@gmail.com> wrote:
>> Another problem is with the .lock file.
>
> In this case you must make sure the shutdown() method is called.

Sorry for the late response, but can you please tell me if you know a
way to do this using Spring? I'm working with JackRabbit via
spring-modules-jcr and not sure how can I force the shutdown in this
case.


And again, I'm having index corruption issues. Don't know if this
helps, but I've noticed that the problem usually occures after a
scheduled procedure performs some processing of the data stored in
repository. After that I can see that the processing was successful,
and all the nodes had changed their state properly, but when I'm
trying to access Iterator-s I receive from queries, they're broken.
Like this:

            final Query q = session.getWorkspace().getQueryManager()
                    .createQuery("//some-node[@node-id='1']", Query.XPATH);
            final NodeIterator i = q.execute().getNodes();
            int size = i.getSize(); // returns 0

So I'm having size=0 despite the fact that <some-node> with node-id=1
property exists in the repository, I can see it among the results of
queries like "//some-node".

After I delete all the indexes, everything is back to normal.

Please, give me at least some pointers.

Maybe this is somehow related to Derby or any other JackRabbit
component issues on FreeBSD?


-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
Thank you, I'll try that for the shutdown issue.

On Fri, Dec 11, 2009 at 1:33 PM, Ben Short <be...@benshort.co.uk> wrote:
> I agree thats a bit tricky :)
>
> You could try extending the JcrSessionFactory and overriding the
> destroy method as follows:
>
> public void destroy() throws Exception {
>                super.destroy();
>                if (repository instanceof JackrabbitRepository)
>                        ((JackrabbitRepository) repository).shutdown();
>        }
>
> The destroy will be called by spring when you undeploy or shutdown
> your webapp and there for the repository should be shut down.
>
> Ben
>
>
>
>
> 2009/12/11 Sergey Podatelev <br...@gmail.com>:
>> On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
>>> Sergey,
>>>
>>> Can I see your spring config that creates the repository?
>>>
>>
>> Sure, but it's a bit tricky cause I had to configure distributed
>> transactions for JCR and MySQL.
>> Going with Jencks was the only way I managed to achieve it.
>>
>> applicationContext.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans ...>
>>
>>  <import resource="jdbc.xml" />
>>  <import resource="jcr.xml" />
>>
>>  <bean id="jtaTransactionManager"
>>      class="org.jencks.factory.TransactionManagerFactoryBean" />
>> ...
>> </beans>
>>
>> jcr.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <beans ...>
>>
>> <bean id="connectionTracker"
>>    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>
>>
>>  <bean id="jrConnectionManager"
>>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>>    <property name="transactionManager">
>>      <ref bean="jtaTransactionManager" />
>>    </property>
>>    <property name="transaction" value="xa"/>
>>    <property name="pooling" value="true" />
>>    <property name="poolMinSize" value="5" />
>>    <property name="poolMaxSize" value="100" />
>>    <property name="connectionTracker" ref="connectionTracker" />
>>  </bean>
>>
>>  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
>>    <property name="managedConnectionFactory">
>>      <ref local="repositoryManagedConnectionFactory"/>
>>    </property>
>>    <property name="connectionManager">
>>      <ref local="jrConnectionManager"/>
>>    </property>
>>  </bean>
>>
>>  <bean id="repositoryManagedConnectionFactory"
>>      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
>>    <property name="homeDir" value="@repo.home@" />
>>    <property name="configFile" value="@repo.config@" />
>>  </bean>
>>
>>
>>  <!-- SessionFactory -->
>>  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
>>    <property name="repository">
>>      <ref local="repository"/>
>>    </property>
>>    <property name="credentials">
>>      <bean class="javax.jcr.SimpleCredentials">
>>        <constructor-arg index="0" value="@repo.login@" />
>>        <constructor-arg index="1" value="@repo.password@" />
>>      </bean>
>>    </property>
>>  </bean>
>>
>>  <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>>    <property name="sessionFactory">
>>      <ref local="jcrSessionFactory"/>
>>    </property>
>>    <property name="allowCreate" value="true"/>
>>  </bean>
>>
>> </beans>
>>
>> jcbc.xml:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>>
>> <beans ...>
>>
>>  <bean id="jdbcConnectionManager"
>>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>>    <property name="transactionManager">
>>      <ref bean="jtaTransactionManager"/>
>>    </property>
>>    <property name="transaction" value="xa"/>
>>  </bean>
>>
>>  <bean id="jdbcManagedConnectionFactory"
>> class="org.jencks.tranql.DataSourceMCF">
>>    <property name="driverName" value="com.mysql.jdbc.Driver" />
>>    <property name="url" value="@mysql.url@" />
>>    <property name="user" value="@mysql.login@" />
>>    <property name="password" value="@mysql.password@" />
>>  </bean>
>>
>>  <bean id="jdbcXaDataSource"
>> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>>    <property name="managedConnectionFactory">
>>      <ref local="jdbcManagedConnectionFactory"/>
>>    </property>
>>    <property name="connectionManager">
>>      <ref local="jdbcConnectionManager" />
>>    </property>
>>  </bean>
>>
>> </beans>
>>
>> All the @...@ values are replaced at build time.
>>
>> --
>> sp
>>
>



-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Ben Short <be...@benshort.co.uk>.
I agree thats a bit tricky :)

You could try extending the JcrSessionFactory and overriding the
destroy method as follows:

public void destroy() throws Exception {
		super.destroy();
                if (repository instanceof JackrabbitRepository)
			((JackrabbitRepository) repository).shutdown();
	}

The destroy will be called by spring when you undeploy or shutdown
your webapp and there for the repository should be shut down.

Ben




2009/12/11 Sergey Podatelev <br...@gmail.com>:
> On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
>> Sergey,
>>
>> Can I see your spring config that creates the repository?
>>
>
> Sure, but it's a bit tricky cause I had to configure distributed
> transactions for JCR and MySQL.
> Going with Jencks was the only way I managed to achieve it.
>
> applicationContext.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
>  <import resource="jdbc.xml" />
>  <import resource="jcr.xml" />
>
>  <bean id="jtaTransactionManager"
>      class="org.jencks.factory.TransactionManagerFactoryBean" />
> ...
> </beans>
>
> jcr.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beans ...>
>
> <bean id="connectionTracker"
>    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>
>
>  <bean id="jrConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager" />
>    </property>
>    <property name="transaction" value="xa"/>
>    <property name="pooling" value="true" />
>    <property name="poolMinSize" value="5" />
>    <property name="poolMaxSize" value="100" />
>    <property name="connectionTracker" ref="connectionTracker" />
>  </bean>
>
>  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="repositoryManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jrConnectionManager"/>
>    </property>
>  </bean>
>
>  <bean id="repositoryManagedConnectionFactory"
>      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
>    <property name="homeDir" value="@repo.home@" />
>    <property name="configFile" value="@repo.config@" />
>  </bean>
>
>
>  <!-- SessionFactory -->
>  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
>    <property name="repository">
>      <ref local="repository"/>
>    </property>
>    <property name="credentials">
>      <bean class="javax.jcr.SimpleCredentials">
>        <constructor-arg index="0" value="@repo.login@" />
>        <constructor-arg index="1" value="@repo.password@" />
>      </bean>
>    </property>
>  </bean>
>
>  <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
>    <property name="sessionFactory">
>      <ref local="jcrSessionFactory"/>
>    </property>
>    <property name="allowCreate" value="true"/>
>  </bean>
>
> </beans>
>
> jcbc.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <beans ...>
>
>  <bean id="jdbcConnectionManager"
>      class="org.jencks.factory.ConnectionManagerFactoryBean">
>    <property name="transactionManager">
>      <ref bean="jtaTransactionManager"/>
>    </property>
>    <property name="transaction" value="xa"/>
>  </bean>
>
>  <bean id="jdbcManagedConnectionFactory"
> class="org.jencks.tranql.DataSourceMCF">
>    <property name="driverName" value="com.mysql.jdbc.Driver" />
>    <property name="url" value="@mysql.url@" />
>    <property name="user" value="@mysql.login@" />
>    <property name="password" value="@mysql.password@" />
>  </bean>
>
>  <bean id="jdbcXaDataSource"
> class="org.jencks.factory.ConnectionFactoryFactoryBean">
>    <property name="managedConnectionFactory">
>      <ref local="jdbcManagedConnectionFactory"/>
>    </property>
>    <property name="connectionManager">
>      <ref local="jdbcConnectionManager" />
>    </property>
>  </bean>
>
> </beans>
>
> All the @...@ values are replaced at build time.
>
> --
> sp
>

Re: FreeBSD indexing and lock file issues

Posted by Sergey Podatelev <br...@gmail.com>.
On Fri, Dec 11, 2009 at 1:11 PM, Ben Short <be...@benshort.co.uk> wrote:
> Sergey,
>
> Can I see your spring config that creates the repository?
>

Sure, but it's a bit tricky cause I had to configure distributed
transactions for JCR and MySQL.
Going with Jencks was the only way I managed to achieve it.

applicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

  <import resource="jdbc.xml" />
  <import resource="jcr.xml" />

  <bean id="jtaTransactionManager"
      class="org.jencks.factory.TransactionManagerFactoryBean" />
...
</beans>

jcr.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans ...>

<bean id="connectionTracker"
    class="org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTrackingCoordinator"/>

  <bean id="jrConnectionManager"
      class="org.jencks.factory.ConnectionManagerFactoryBean">
    <property name="transactionManager">
      <ref bean="jtaTransactionManager" />
    </property>
    <property name="transaction" value="xa"/>
    <property name="pooling" value="true" />
    <property name="poolMinSize" value="5" />
    <property name="poolMaxSize" value="100" />
    <property name="connectionTracker" ref="connectionTracker" />
  </bean>

  <bean id="repository" class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <ref local="repositoryManagedConnectionFactory"/>
    </property>
    <property name="connectionManager">
      <ref local="jrConnectionManager"/>
    </property>
  </bean>

  <bean id="repositoryManagedConnectionFactory"
      class="org.apache.jackrabbit.jca.JCAManagedConnectionFactory">
    <property name="homeDir" value="@repo.home@" />
    <property name="configFile" value="@repo.config@" />
  </bean>


  <!-- SessionFactory -->
  <bean id="jcrSessionFactory" class="org.springmodules.jcr.JcrSessionFactory">
    <property name="repository">
      <ref local="repository"/>
    </property>
    <property name="credentials">
      <bean class="javax.jcr.SimpleCredentials">
        <constructor-arg index="0" value="@repo.login@" />
        <constructor-arg index="1" value="@repo.password@" />
      </bean>
    </property>
  </bean>

 <bean id="jcrTemplate" class="org.springmodules.jcr.JcrTemplate">
    <property name="sessionFactory">
      <ref local="jcrSessionFactory"/>
    </property>
    <property name="allowCreate" value="true"/>
  </bean>

</beans>

jcbc.xml:

<?xml version="1.0" encoding="UTF-8"?>

<beans ...>

  <bean id="jdbcConnectionManager"
      class="org.jencks.factory.ConnectionManagerFactoryBean">
    <property name="transactionManager">
      <ref bean="jtaTransactionManager"/>
    </property>
    <property name="transaction" value="xa"/>
  </bean>

  <bean id="jdbcManagedConnectionFactory"
class="org.jencks.tranql.DataSourceMCF">
    <property name="driverName" value="com.mysql.jdbc.Driver" />
    <property name="url" value="@mysql.url@" />
    <property name="user" value="@mysql.login@" />
    <property name="password" value="@mysql.password@" />
  </bean>

  <bean id="jdbcXaDataSource"
class="org.jencks.factory.ConnectionFactoryFactoryBean">
    <property name="managedConnectionFactory">
      <ref local="jdbcManagedConnectionFactory"/>
    </property>
    <property name="connectionManager">
      <ref local="jdbcConnectionManager" />
    </property>
  </bean>

</beans>

All the @...@ values are replaced at build time.

-- 
sp

Re: FreeBSD indexing and lock file issues

Posted by Ben Short <be...@benshort.co.uk>.
Sergey,

Can I see your spring config that creates the repository?

Ben


2009/12/11 Sergey Podatelev <br...@gmail.com>:
> On Mon, Nov 16, 2009 at 4:07 PM, Alexander Klimetschek <ak...@day.com> wrote:
>> On Mon, Nov 16, 2009 at 11:56, Sergey Podatelev
>> <br...@gmail.com> wrote:
>>> Another problem is with the .lock file.
>>
>> In this case you must make sure the shutdown() method is called.
>
> Sorry for the late response, but can you please tell me if you know a
> way to do this using Spring? I'm working with JackRabbit via
> spring-modules-jcr and not sure how can I force the shutdown in this
> case.
>
>
> And again, I'm having index corruption issues. Don't know if this
> helps, but I've noticed that the problem usually occures after a
> scheduled procedure performs some processing of the data stored in
> repository. After that I can see that the processing was successful,
> and all the nodes had changed their state properly, but when I'm
> trying to access Iterator-s I receive from queries, they're broken.
> Like this:
>
>            final Query q = session.getWorkspace().getQueryManager()
>                    .createQuery("//some-node[@node-id='1']", Query.XPATH);
>            final NodeIterator i = q.execute().getNodes();
>            int size = i.getSize(); // returns 0
>
> So I'm having size=0 despite the fact that <some-node> with node-id=1
> property exists in the repository, I can see it among the results of
> queries like "//some-node".
>
> After I delete all the indexes, everything is back to normal.
>
> Please, give me at least some pointers.
>
> Maybe this is somehow related to Derby or any other JackRabbit
> component issues on FreeBSD?
>
>
> --
> sp
>