2 Replies Latest reply on May 7, 2019 8:19 AM by Ryan Slominski

    jboss-cli does not work if path contains symbolic link

    Ryan Slominski Newbie

      The jboss-cli.sh script works if invoked from an absolute path, or a relative path with a symbolic link resulting in a path of the same depth as the canonical path, however a symbolic link creating a path of a different depth results in error.  This is inconvenient as I often have multiple versions of Wildfly and use a symbolic link to point to the current version.   The workaround when using symbolic links is to use "cd -P" to first resolve the symbolic link or ensure symbolic link doesn't change path length.   It isn't a huge, deal, but also seems like not a huge deal to fix either.  Anyone else notice this.  Any reason not to fix this?

       

      Here is an example of what happens when invoking the script via symbolic link named "bin", which results in a path length that differs from the canonical path length:

      [root@wildflytest wildfly]# pwd
      /opt/wildfly
      [root@wildflytest wildfly]# ls -ltr
      total 0
      drwxrwxr-x. 12 wildfly wildfly 255 Sep  5  2018 14.0.1
      lrwxrwxrwx.  1 wildfly wildfly  28 Sep 26  2018 configuration -> pro/standalone/configuration
      lrwxrwxrwx.  1 wildfly wildfly  18 Sep 26  2018 log -> pro/standalone/log
      drwxr-xr-x. 11 wildfly wildfly 239 Feb 27 18:49 16.0.0
      lrwxrwxrwx.  1 wildfly wildfly   6 Apr 24 16:14 pro -> 16.0.0
      lrwxrwxrwx.  1 root    root      7 Apr 30 07:24 bin -> pro/bin
      [root@wildflytest wildfly]# bin/jboss-cli.sh --connect
      Error: Unable to access jarfile /opt/wildfly/jboss-modules.jar
      [root@wildflytest wildfly]#

       

      Note: the following has a link, but results in a path length equal to canonical path and works:

      [root@wildfly2 wildfly]# pro/bin/jboss-cli.sh --connect
      [standalone@localhost:9990 /]
        • 1. Re: jboss-cli does not work if path contains symbolic link
          Jaikiran Pai Master

          I am not 100% sure this has to do with path lengths. Looking at the output of "ls" command you pasted, I think this has to do with the permissions of those directories. You will notice that the symlinked /pro/bin directory has "root" user permissions. I suspect you might be starting the server as a non-root user which is causing this access denial issue, resulting in the failure to launch that jar.

          • 2. Re: jboss-cli does not work if path contains symbolic link
            Ryan Slominski Newbie

            This doesn't appear to be a permissions issue.  If I change ownership of the symbolic link to user wildfly and even execute the command as user wildfly, I still see the same output.  For example:

             

            [root@wildflytest wildfly]# chown -R wildfly:wildfly /opt/wildfly
            [root@wildflytest wildfly]# ls -ltr
            total 0
            drwxr-xr-x. 11 wildfly wildfly 239 Feb 27 18:49 16.0.0
            lrwxrwxrwx.  1 wildfly wildfly  6 Apr 25 11:33 pro -> 16.0.0
            lrwxrwxrwx.  1 wildfly wildfly  28 Apr 25 11:33 configuration -> pro/standalone/configuration
            lrwxrwxrwx.  1 wildfly wildfly  18 Apr 25 11:33 log -> pro/standalone/log
            lrwxrwxrwx.  1 wildfly wildfly  7 May  7 08:05 bin -> pro/bin
            [root@wildflytest wildfly]# sudo -u wildfly bin/jboss-cli.sh --connect
            Error: Unable to access jarfile /opt/wildfly/jboss-modules.jar