0 Replies Latest reply: Feb 4, 2010 11:33 PM by 807559 RSS

    Locking a NFS mounted file throws IOException in Solaris

      Problem Description:

      When mounted files are tried to lock, it throws the following exception

      java.io.IOException: Invalid argument

      at sun.nio.ch.FileChannelImpl.lock0(Native Method)

      at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:842)

      Code snippet to reproduce the problem:

      Private static RandomAccessFile raLicFile;
      File f = new File(licfile);
      raLicFile = new RandomAccessFile(f, "r");
      FileCannel fChannel = raLicFile.getChannel();
      LicenseTextDataSource.lock = fChannel.lock(0L,Long.MAX_VALUE,true); //This throws IOException

      Reproducing the problem:

      This problem is reproducible in only Solaris machine.
      but again not in all versions of Solaris.

      Two machines should be used to reproduce the problem say A and B. In m/c A the file which needs to be locked and the test application is stored. This folder is mounted on another machine B and the test application is launched in B.

      Please let me know whether this is an issue in Solaris machine and any specific version of Solaris.

      Currently we are able to reproduce when both the machines are Solaris 5.10.

      Jre used : 1.5