This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
In which case that code is just not going to work. You can't reliably call getRealPath for a path inside a war file (as the JavaDocs for getRealPath() say). You will need to change the code to either get the location of the path from somewhere else, or load whethever you need from the war file as a resource via the classloader.