This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Well, to be pedantic, that wouldn't be a literal file in any case. According to the J2EE spec, a deployed webapp is a WAR file, and this would just be one of the objects within the WAR that, if the WAR is unzipped would become an independent file.
There are 2 most likely causes for your problem. One is if you're asking for a FacesContext outside of the JSF context. In which case, you'd get a NullPointer.
The other is failure to specifiy the resource location properly on the getResourceAsStream request. The resource location is relative to the WAR, not the URL, so the proper value would be "/WEB-INF/myfile.txt" or something similar.
And, although you're evidently not intending to do so, I should repeat that old warning that WRITING to anything in a WAR is something that should not be done!
An IDE is no substitute for an Intelligent Developer.