Hello dear members,
I have no experience with Linux server. I am building a java application which will save files into server, uploaded by users. I have to deploy the application to a remote linux server. but the code of writing a file into that server seems not to be working. later i tried a simple jsp script to test if I can write any file to that server:
the directory var/www/vhosts/mysite.com/httpdocs are already existed in the server. I made all of their chmod = 777 through ftp.
but it does not create the folder and write the file.
I put the code into try catch and printed the exception- it shows:
Well, the obvious thing to check is that the permissions on the "httpdocs" directory actually allow you to write to it. It's one thing to run a "chmod" command; it's another thing for that command to actually take effect.
It's very likely that selinux is forbidding the operation. On Red Hat-style distros, the message would appear in the /var/log/audit file. You can use the "Z" option of the ls command to see selinux attributes ("ls -lZ /var/www")
Regardless, I don't recommend writing to the /var/www directory or its children. That's opening up your webapps for exploits. The preferable place for writable webapp-related files is generally something like /var/lib/myappname. And, of course, absolutely positively never write files to locations inside of your deployed WAR!
Customer surveys are for companies who didn't pay proper attention to begin with.
subject: Java file.mkdir() does not work even after chmod set to 777