title: Access to NFS-Share from Java-Application
body: <p>I am trying to access a NFS share on a CentOS 6.3 System from within a Java application. I've tried the following libraries but can't get either to work:</p>
  
  <h2><a href="https://github.com/raisercostin/yanfs" rel="nofollow noreferrer">YaNFS</a></h2>
  
  <p>Trying to access the NFS Share with YaNFS I run into an NfsException with ErrorCode 10001 (NFSERR_BADHANDLE). Sometimes the text of the Exception says "Stale NFS file handle". My code for YaNFS is:</p>
  
  <pre><code>    public static void main(String[] args) {
      XFile xf = new XFile("nfs://192.168.1.10/nfs-share");
  
      nfsXFileExtensionAccessor nfsx =
          (nfsXFileExtensionAccessor)xf.getExtensionAccessor();
  
          if (! nfsx.loginPCNFSD("192.168.1.10", "rpx-nfs-user", "Test123!")) {
               System.out.println("login failed");
               return;
          }
  
          if (xf.canRead())
               System.out.println("Read permission OK");
          else
               System.out.println("No Read permission");
  
  }
  </code></pre>
  
  <h2><a href="https://github.com/EMCECS/nfs-client-java" rel="nofollow noreferrer">nfs-client-java</a></h2>
  
  <p>Trying to initialize Nfs3 object with "nfs-client-java" I get a MountException that looks like:</p>
  
  <pre><code>com.emc.ecs.nfsclient.mount.MountException: mount failure, 
      server: 192.168.1.205, 
      export: /home/share, 
      nfs version: 3, 
      returned state: 13
  at com.emc.ecs.nfsclient.nfs.nfs3.Nfs3.lookupRootHandle(Nfs3.java:359)
  </code></pre>
  
  <p>State 13 on this point says Permission denied.</p>
  
  <hr>
  
  <p>I can access this share from another CentOS-System (with authorized to access to this folder uid and gid) by mounting this share and from Windows-System(with authorized to access to this folder login and password) as well.</p>
  
  <p>Is there anyone, who has already solved this problem? Or maybe someone can help me get further?</p>