jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@day.com>
Subject Re: Problems with XA transaction rollback
Date Wed, 28 May 2008 12:39:33 GMT
On Tue, May 27, 2008 at 11:16 AM, Anand Bhagwat <abbhagwatgm@gmail.com> wrote:
> I am using jackrabbit in XA transactions running on JBoss server. For that I
> have configured jackrabbit as a JCA resource on JBoss. For transaction
> management I am using spring's JTATransactionManager. So I am getting my
> repository through JNDI lookup. This setup is working fine. But the problem
> is coming when an exception is thrown. I have configured my transaction to
> rollback on RepositoryException but my observation is that the file which I
> am storing on jackrabbit file system is not getting rollbacked i.e. it is
> still created under jackrabbit repository. Though all the related entries
> (metadata) in database are getting rollbacked.

how did you configure your repository (PersistenceManager etc)?

cheers
stefan

>
> The scenario is like this (check the code snippet below) I am calling a
> method called addTransactionTest which is internally is calling addDocument
> which adds the document in repository. In this scenario first call to
> addDocument succeeds but the second method fails due to RepositoryException.
> So I am expecting that the changes made by both methods should get rollback.
> But this is not happening and the document added by my first call is
> persisted on file system.
> *
> Code snippet :
> **void addDocument(String name, InputStream content) throws
> RepositoryException {
> **// Add the document to repository
> ......
> ......
>
> // Save the session
> jcrSession.save();
> *
> *}
>
> void addTransactionTest() **throws RepositoryException **{
> **......
> *
> *addDocument(String name, InputStream content);
> addDocument(String name, InputStream content);
> ......
> *
> *}*
>
> *Here is my spring configuration :
>    ........
>    ........
> * *    <bean id="txProxyTemplate" abstract="true"
>
> class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
>        <property name="proxyTargetClass" value="true" />
>        <property name="transactionManager" ref="jtaTransactionManager" />
>        <property name="transactionAttributes">
>            <props>
>                <prop key="add*">PROPAGATION_REQUIRED,
> -RepositoryException</prop>
>            </props>
>        </property>
>    </bean>*
>
> *    <bean id="repository"
>        class="org.springframework.jndi.JndiObjectFactoryBean">
>        <property name="jndiName" value="java:jcr/myRepository" />
>    </bean>
>     ........
> *
> Also I read about transactions on JSR-170 spec and this what they have to
> say:
> *
> "Within a transaction, changes made by save (or other, workspacedirect,
> methods) are transactionalized and are only persisted and
> published (made visible to other sessions), upon commit of the
> transaction. A rollback will, conversely, revert the effects of any
> saves or workspace-direct methods called within the transaction.
>
> Note, however, that changes made in the transient storage are not
> recorded by a transaction. This means that a rollback will not revert
> changes made to the transient storage of the Session. After a
> rollback the Session object state will still contain any pending
> changes that were present before the rollback."
>
> *
> So do I need to do anything else to make this work?
> *
> *
> Regards,
> Anand.
>
> *
> *
>

Mime
View raw message