jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus Reis <markus.r...@researchstudio.at>
Subject JBoss and Jackrabbit JCA
Date Mon, 06 Aug 2007 10:46:24 GMT
Dear All,

I'm currently playing around with Jackrabbit's jca package and end up in 
some strange errors (which will mainly be due to wrong use from my code 
:-)). Here's my environment:
JBoss 4.0.5.GA
Java 1.5_06
Jackrabbit 1.3.1 (checked out and build tagged version)
jcr-ds.xml (only modified homeDir property - I experimented with both 
true and false for bindSessionToTransaction):
        <config-property name="homeDir" 
        <config-property name="configFile" 
        <config-property name="bindSessionToTransaction" 

Here's my client code:
    XAResource xares = 
//xares is either of type org.apache.jackrabbit.core.XASessionImpl (if 
bindSessionToTransaction is set to false and 
org.apache.jackrabbit.jca.TransactionBoundXAResource if set to true)
    // create dummy Xid
    Xid xid = new XidImpl(counter++); //XidImpl is simply copied from 
//I think I shouldn't do that :-)
    xares.start(xid, XAResource.TMNOFLAGS);

           // .... add new nodes & properties and save them   
            Node root = session.getRootNode();
            Node child = root.hasNode(path.getRelativePath()) ? 
root.getNode(path.getRelativePath()) : createFilePath(root, 
path.getPathParts(), path.getObjectName());
            FileTypeResolver ftr = FileTypeResolver.instantiate();
            child.setProperty("jcr:mimeType", ftr.getMIMEType(obj));
            child.setProperty("jcr:data", new FileInputStream(obj));
            Calendar rightNow = Calendar.getInstance();
            child.setProperty("jcr:lastModified", rightNow);
            //child.setProperty("original-file-name", obj.getName());

    xares.end(xid, XAResource.TMSUCCESS);
    xares.commit(xid, false);
If I set bindSessionToTransaction to false and disassociate the 
XAResource from it's transaction (calling associate(null)), I can start 
(and end and commit) the transaction successfully - I have however the 
strong feeling that I shouldn't do that :-)
If I set bindSessionToTransaction to true (which would be the default) 
or if I do not disassociate the XAResource from it's transaction then I 
always get an exception thrown at XASessionImpl line 227 (remember that 
I'm working on 1.3.1).

I never found out why the XAResource was associated with a transaction 
although bindSessionToTransaction was set to false.

It would be great if someone could tell me what I'm doing wrong and/or 
point me to sample code that should work in my environment and/or tell 
me if she/he already did something similar successfully when deployed on 

many thanks,

View raw message