xadisk
  1. xadisk
  2. XADISK-123

FileNotFoundException if file is stored on a NFS-Server different to the xaDiskHome (XADiskSystemDirectory)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: None
    • Labels:
      None
    • Environment:

      Websphere7,
      Spring 3.1.2,
      AIX,
      XADisk 1.2.1 as JCA Resource Adapter

      Description

      File operations on files are failing with a FileNotFoundException during the commit, if the files are stored on a NFS-Server different to the filesystem of the xaDiskHome.
      It works, if the direcory is mounted on the same NFS-Server where the xaDiskHome reside's.

      Stacktrace:

      Caused by: javax.transaction.SystemException: XAResource start association error:XAER_RMFAIL
              at com.ibm.tx.jta.RegisteredResources.startRes(RegisteredResources.java:1041)
              at com.ibm.ws.tx.jta.RegisteredResources.enlistResource(RegisteredResources.java:1099)
              at com.ibm.ws.tx.jta.TransactionImpl.enlistResource(TransactionImpl.java:2169)
              at com.ibm.ws.tx.jta.TranManagerSet.enlist(TranManagerSet.java:526)
              at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:715)
              ... 29 more
      Caused by: javax.transaction.xa.XAException
              at org.xadisk.filesystem.utilities.MiscUtils.createXAExceptionWithCause(MiscUtils.java:16)
              at org.xadisk.connector.XAResourceImpl.start(XAResourceImpl.java:44)
              at com.ibm.ejs.j2c.XATransactionWrapper.start(XATransactionWrapper.java:1463)
              at com.ibm.ws.Transaction.JTA.JTAResourceBase.start(JTAResourceBase.java:148)
              at com.ibm.tx.jta.RegisteredResources.startRes(RegisteredResources.java:990)
              ... 33 more
      Caused by: org.xadisk.filesystem.exceptions.XASystemNoMoreAvailableException: The XADisk instance has encoutered a critial issue and is no more available. Su
      ch a condition is very rare. If you think you have setup everything right for XADisk to work, please consider discussing in XADisk forums, or raising a bug w
      ith details
              at org.xadisk.filesystem.NativeXAFileSystem.checkIfCanContinue(NativeXAFileSystem.java:501)
              at org.xadisk.filesystem.NativeXAFileSystem.createSessionForXATransaction(NativeXAFileSystem.java:270)
              at org.xadisk.filesystem.NativeXAFileSystem.createSessionForXATransaction(NativeXAFileSystem.java:54)
              at org.xadisk.filesystem.NativeXASession.refreshSessionForNewXATransaction(NativeXASession.java:201)
              at org.xadisk.connector.XAResourceImpl.start(XAResourceImpl.java:41)
              ... 36 more
      Caused by: java.io.FileNotFoundException: /usr/data/test/usrdat/MB999MTEST.79.7917179 (No such file or directory)
              at java.io.FileInputStream.<init>(FileInputStream.java:123)
              at org.xadisk.filesystem.utilities.FileIOUtility.renameTo(FileIOUtility.java:33)
              at org.xadisk.filesystem.DurableDiskSession.renameTo(DurableDiskSession.java:142)
              at org.xadisk.filesystem.NativeSession.commitMove(NativeSession.java:871)
              at org.xadisk.filesystem.NativeSession.commitFileMove(NativeSession.java:856)
              at org.xadisk.filesystem.NativeSession.commit(NativeSession.java:714)
              at org.xadisk.connector.XAResourceImpl.commit(XAResourceImpl.java:131)
              at com.ibm.ejs.j2c.XATransactionWrapper.commit(XATransactionWrapper.java:485)
              at com.ibm.tx.jta.JTAXAResourceImpl.commit(JTAXAResourceImpl.java:296)
              at com.ibm.tx.jta.RegisteredResources.deliverOutcome(RegisteredResources.java:1574)
              at com.ibm.tx.jta.RegisteredResources.distributeOutcome(RegisteredResources.java:1926)
              at com.ibm.tx.jta.RegisteredResources.distributeCommit(RegisteredResources.java:2238)
              at com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1868)
              at com.ibm.tx.jta.TransactionImpl.internalCommit(TransactionImpl.java:1844)
              at com.ibm.tx.jta.TransactionImpl.coreStage2CommitProcessing(TransactionImpl.java:1091)
              at com.ibm.tx.jta.TransactionImpl.stage2CommitProcessing(TransactionImpl.java:1136)
              at com.ibm.tx.jta.TransactionImpl.processCommit(TransactionImpl.java:990)
              at com.ibm.tx.jta.TransactionImpl.commit(TransactionImpl.java:920)
              at com.ibm.ws.tx.jta.TranManagerImpl.commit(TranManagerImpl.java:436)
              at com.ibm.tx.jta.TranManagerSet.commit(TranManagerSet.java:161)
              at com.ibm.ws.tx.jta.UserTransactionImpl.commit(UserTransactionImpl.java:293)
              at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1010)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
              at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
      

        Activity

        Hide
        Nitin Verma added a comment -

        Hello.

        Can you please let me know the output of the following APIs (say, f1 is the file you want to move, and it is located on a different NFS than xadiskHome. this is the case which is failing, right?):

        f1.renameTo(f2); //here f2 is some path in the file-system of xadiskHome and there should not be any file at this location.

        Please let me know the return value of the above method. Then, please also check the return value of:

        f1.exists();

        Thanks,
        Nitin

        Show
        Nitin Verma added a comment - Hello. Can you please let me know the output of the following APIs (say, f1 is the file you want to move, and it is located on a different NFS than xadiskHome. this is the case which is failing, right?): f1.renameTo(f2); //here f2 is some path in the file-system of xadiskHome and there should not be any file at this location. Please let me know the return value of the above method. Then, please also check the return value of: f1.exists(); Thanks, Nitin
        Hide
        tengvig added a comment -

        I got the same error in the same situation. The error seems to occur in org.xadisk.filesystem.utilities.FileIOUtility
        When the source and destination files are on different file systems, the file is copied and deleted.

        public static void renameTo(File src, File dest) throws IOException {
        if (!src.renameTo(dest)) {
        if (renamePossible(src, dest)) {
        while (!src.renameTo(dest)) {

        The while loop on line 27 above does not terminate causing the exception to occur on the second run when the file already is copied and the source file is deleted.
        I changed it to:
        while (src.exists() && !src.renameTo(dest)) {

        which fixes the problem for me.

        Show
        tengvig added a comment - I got the same error in the same situation. The error seems to occur in org.xadisk.filesystem.utilities.FileIOUtility When the source and destination files are on different file systems, the file is copied and deleted. public static void renameTo(File src, File dest) throws IOException { if (!src.renameTo(dest)) { if (renamePossible(src, dest)) { while (!src.renameTo(dest)) { The while loop on line 27 above does not terminate causing the exception to occur on the second run when the file already is copied and the source file is deleted. I changed it to: while (src.exists() && !src.renameTo(dest)) { which fixes the problem for me.
        Hide
        Nitin Verma added a comment -

        Hello stendres (sorry I don't know your name),

        Can you please confirm if the above change fixes the problem you mentioned.

        Thanks,
        Nitin

        Show
        Nitin Verma added a comment - Hello stendres (sorry I don't know your name), Can you please confirm if the above change fixes the problem you mentioned. Thanks, Nitin
        Hide
        Nitin Verma added a comment -

        Based on the comments from tengvig, I will fix and close this issue. Though, we could not yet get a confirmation from the original reporter of the issue if the proposed solution fixes the problem at his end.

        Thanks tengvig for identifying the problem.

        Regards,
        Nitin

        Show
        Nitin Verma added a comment - Based on the comments from tengvig, I will fix and close this issue. Though, we could not yet get a confirmation from the original reporter of the issue if the proposed solution fixes the problem at his end. Thanks tengvig for identifying the problem. Regards, Nitin
        Hide
        Nitin Verma added a comment -

        Checked-in the changes to trunk.

        Show
        Nitin Verma added a comment - Checked-in the changes to trunk.

          People

          • Assignee:
            Nitin Verma
            Reporter:
            stendres
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: