jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: Problem with node.checkin() in same transaction node was created
Date Mon, 22 Sep 2008 08:24:54 GMT
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

Mime
View raw message