0

I am trying to access a file on my MacBook Pro via a web app running on Tomcat in Eclipse (localhost). Whenever I try to access the file I receive the following IO Exception:

Exception:  /private/var/appname/app_config.txt (No such file or directory)

This file does exist and when I use Apple+I the file info window gives this location:

/private/var/appname

So why does the web app get the (No such file or directory) exception? How do I get the real path if the file info window isn't valid via web app?

EDIT

The permissions on the file in questions are:

-rw-r--r--

where the owner is the user context the web app is running under, which is determined by entering the following into the shell:

ps axu -w

Permissions on the directory appname are as such:

drwxr-x---   

where again, the owner is the user context the web app is running under.

And finally, the directory var has permissions:

drwxr-xr-x

with root as owner.

enter image description here

Furthermore, removing private from the path results in the exact same exception, sans the private in the path:

Exception:  /var/appname/app_config.txt (No such file or directory)
  • Check the log file at /private/var/log/system.log, and if you're using Apache with Tomcat you may need to configure it. – l'L'l Jan 23 '14 at 22:06
  • @l'L'l It's just Tomcat 7 - No Apache web server. – Roy Hinkley Jan 24 '14 at 16:32
1

What user identity is the Tomcat / Apache application running as? While you can read the file with your account, if the application server is running as a limited rights user or in a chroot'd environment, you'll not be able to see the file. Find out the user account it is running as and try suing to that account then see if you can read the file.

0

The first thing I would check is that Tomcat or Eclipse or whatever is that you are trying to access the file with has enough rights for the operation. It is not unusual for applications to report "file not found" when what they are trying to say is "I cannot access the thing"

Open Terminal, do

cd /private/var/appname

and then

ls -al

and see who owns it and what mode the file reports, and then take it from there.

Given that /private/var/appname is not readable by everyone I'd add that to the permissions and see if that makes a difference.

chmod a+r /private/var/appname 
  • To be totally sure I'd make it -la@ to get the ACL if any as well. This is almost certainly a permissions problem on either the directory or the file itself. – Tony Williams Jan 23 '14 at 23:11
  • @TonyWilliams No doubt it's likely permissions. But, I am struggling with what to set them at. Please review my edits which include the permissions currently. – Roy Hinkley Jan 24 '14 at 14:39
  • @Android Addict - May be the HFS is playing with us. Are you able to actually open the file from a different app, says TextWrangler or so?. Why not momentarily allowing full access to the file via sudo chmod 777? – cucu8 Jan 24 '14 at 19:41
  • Yes. TextEdit/TextWrangler work just fine. I will consider opening it up just to determine something else is not going wrong - Thanks for the advice. – Roy Hinkley Jan 24 '14 at 21:10
  • If you can open it with an editor then we have to conclude that the problem is with Java/Eclipse. I am afraid I have to leave you here then, my experience being ~zero on that area (well I can try to glean something from log files... but that's about it). Good luck. – cucu8 Jan 25 '14 at 11:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .