2 Replies Latest reply on Jan 21, 2011 10:54 AM by fkj

    Problem with symbolic link

    fkj

      I'm trying to create a symbolic link inside my application at runtime.


      String realPath = getServletContext().getRealPath("/download");
      realPath += "/tmp";
      if(!FileUtils.isSymlink(new File(realPath)))
      {
           Runtime.getRuntime().exec("ln -s /tmp " + realPath);
      }



      After the symbolic link is created my application stops working and I get the following exception:




      java.lang.NullPointerException
           org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:155)
           org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:160)
           org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:160)
           org.jboss.seam.deployment.URLScanner.handleDirectory(URLScanner.java:160)
           org.jboss.seam.deployment.URLScanner.scanDirectories(URLScanner.java:48)
           org.jboss.seam.deployment.WarRootDeploymentStrategy.scan(WarRootDeploymentStrategy.java:77)
           org.jboss.seam.deployment.ForwardingDeploymentStrategy.scan(ForwardingDeploymentStrategy.java:31)
           org.jboss.seam.deployment.TimestampCheckForwardingDeploymentStrategy.changedSince(TimestampCheckForwardingDeploymentStrategy.java:15)
           org.jboss.seam.init.Initialization.redeploy(Initialization.java:812)
           org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:45)
           org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      




      Any ideas?


      Thanks,
      Felipe

        • 1. Re: Problem with symbolic link
          jeanluc
          Are you sure there is a cause & effect relationship here? It's unlikely executing an external command would trigger a redeploy.
          • 2. Re: Problem with symbolic link
            fkj

            The problem is the symlink itself. If I execute the command from the terminal the problem happens too, and the application returns to work only if I remove it.


            I think it can be some permission issue. I changed the link to the home folder of my user instead of /tmp and it worked fine.