On Amazon Linux 2 AMI:
$ cd /opt/wildfly/bin
$ ./jboss-cli.sh -c
[standalone@localhost:9990 /] /subsystem=undertow/configuration=handler/file=PhotosDirHandler/:add(cache-buffer-size=1024,cache-buffers=1024,directory-listing=true,follow-symlink=true,path=/home/ec2-user/DocRoot/CloudStorage/PhotoStorage/)
{ "outcome" => "failed", "failure-description" => "WFLYUT0095: the path ['/home/ec2-user/DocRoot/CloudStorage/PhotoStorage/'] doesn't exist on file system", "rolled-back" => true }
[standalone@localhost:9990 /]
The path exists on Linux 2 file system:
$ ls /home/ec2-user/DocRoot/CloudStorage/PhotoStorage/
defaultUserPhoto.png
DocRoot is owned by ec2-user with read/write/delete permissions recursively for all so that WildFly can write into the directories.
$ ls -l drwxrwxrwx 3 ec2-user ec2-user 26 Feb 12 19:51 DocRoot
I am getting the same error message after changing all of the file path directory names to lowercase. It does not seem to be a case sensitive issue.
It is quite common to store/retrieve files outside of the WildFly WAR deployment directory instead of using the database for storage and retrieval of those files. I am surprised that it does not work on Amazon Linux 2, which is like CentOS and RHEL. It worked very nicely on my iMac running macOS Catalina.
What would cause it not to work on Amazon Linux 2? Is it a Linux 2 permissions setting or a WildFly bug?
Your help will be much appreciated!
The /home/ec2-user/ path does not work for the storage and retrieval of external files under WildFly Undertow subsytem when running on Amazon AWS EC2 instance running Linux 2.
I resolved the problem by creating the storage locations in the WildFly installation directory as follows:
/opt/wildfly/DocRoot/CloudStorage/FileStorage/
/opt/wildfly/DocRoot/CloudStorage/PhotoStorage/
Everything worked nicely!