jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anand Bhagwat" <abbhagwa...@gmail.com>
Subject Problems with XA transaction rollback
Date Tue, 27 May 2008 09:16:31 GMT
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.

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

void addTransactionTest() **throws RepositoryException **{
*addDocument(String name, InputStream content);
addDocument(String name, InputStream content);

*Here is my spring configuration :
* *    <bean id="txProxyTemplate" abstract="true"

        <property name="proxyTargetClass" value="true" />
        <property name="transactionManager" ref="jtaTransactionManager" />
        <property name="transactionAttributes">
                <prop key="add*">PROPAGATION_REQUIRED,

*    <bean id="repository"
        <property name="jndiName" value="java:jcr/myRepository" />
Also I read about transactions on JSR-170 spec and this what they have to
"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?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message