jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kenclark <kencl...@snet.net>
Subject Re: Problem with node.checkin() in same transaction node was created
Date Mon, 22 Sep 2008 14:07:11 GMT


I reread the spec, and it is still not clear to me what exactly happens with
the root version.  My assumption was that it is, like you say, exactly like
any other version -- it should be a copy of the versioned node as of the
time the version was created (i.e. the initial save of the node).

However, this is not what I am seeing, as I point out in the other post:

http://www.nabble.com/How-do-I-make-a-first-version-when-versioning--td19601595.html

Perhaps I am missing something when traversing the version tree -- I will
double check this.  

Thanks also for the heads up on the XMLPersistenceManager -- I will look
into switching to another PM.

Thanks,
ken




Alexander Klimetschek wrote:
> 
> The initial version of a node (when you add the mix:versionable) is
> created upon save(), there is no need to call checkin. See here
> http://markmail.org/message/2alwjclh6kecpbdn or have a look at section
> 8 of the JCR spec http://jcp.org/en/jsr/detail?id=170.
> 
> Regards,
> Alex
> 
> On Mon, Sep 22, 2008 at 5:53 AM, kenclark <kenclark@snet.net> wrote:
>>
>> I am trying to create a node (nt:file), save its parent folder, and then
>> checkin the node.  When I do this, I receive a transaction error (see
>> below).  The node does get created, but is corrupt -- it is missing the
>> jcr:mimeType child node, at least.
>>
>> If I leave out the checkin, everything works fine.
>>
>> Here is the code snippet:
>>
>>        Node fileNode = folderNode.addNode (filename, "nt:file");
>>        fileNode.addMixin("mix:versionable");
>>        fileNode.addMixin("mix:referenceable");
>>        fileNode.addMixin("kk:authored");
>>        fileNode.setProperty("kk:authorid", userId);
>>        fileNode.setProperty("kk:filename", filename);
>>
>>        //create the mandatory child node - jcr:content
>>        FileInputStream fis = null;
>>
>>        try
>>        {
>>            fis = new FileInputStream (file);
>>            Node resNode = fileNode.addNode ("jcr:content",
>> "nt:resource");
>>            resNode.setProperty ("jcr:mimeType", getMimeType(file));
>>            resNode.setProperty ("jcr:encoding", encoding);
>>            resNode.setProperty ("jcr:data", fis);
>>            Calendar lastModified = Calendar.getInstance ();
>>            lastModified.setTimeInMillis (file.lastModified ());
>>            resNode.setProperty ("jcr:lastModified", lastModified);
>>
>>            folderNode.save();
>>            fileNode.checkin();
>>
>>            return fileNode;
>>        }
>>        finally
>>        {
>>            if (fis != null) fis.close();
>>        }
>>
>> and here is the error:
>>
>> 23:46:24,250 WARN  [loggerI18N]
>> [com.arjuna.ats.internal.jta.resources.arjunacore.commitxaerror]
>> [com.arjuna.ats.internal.jta.resources.arju
>> nacore.commitxaerror] XAResourceRecord.commit - xa error
>> XAException.XA_RBOTHER
>> 23:46:24,265 ERROR [SeamPhaseListener] uncaught exception
>> java.lang.IllegalStateException: Could not commit transaction
>>        at
>> org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:602)
>>        at
>> org.jboss.seam.jsf.SeamPhaseListener.handleTransactionsAfterPhase(SeamPhaseListener.java:330)
>>        at
>> org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:231)
>>        at
>> org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
>>        at
>> com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
>> ...
>> Caused by: javax.transaction.HeuristicMixedException
>>        at
>> com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1395)
>>        at
>> com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
>>        at
>> com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
>>        at
>> org.jboss.tm.usertx.client.ServerVMClientUserTransaction.commit(ServerVMClientUserTransaction.java:140)
>>        at
>> org.jboss.seam.transaction.UTTransaction.commit(UTTransaction.java:52)
>>        at
>> org.jboss.seam.jsf.SeamPhaseListener.commitOrRollback(SeamPhaseListener.java:592)
>>        ... 60 more
>>
>> Thanks,
>> ken clark
>> --
>> View this message in context:
>> http://www.nabble.com/Problem-with-node.checkin%28%29-in-same-transaction-node-was-created-tp19601525p19601525.html
>> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-with-node.checkin%28%29-in-same-transaction-node-was-created-tp19601525p19608659.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message