DON'T DO THAT!!!
You should never attempt to write any sort of files into your WAR. Treat it as a read-only resource. On a lot of servers, depending on configuration, it
is a read-only resource.
On the rest of them, you can get into a lot of trouble writing stuff into a WAR. For one thing, a redeployment will destroy your data.
Always select an external directory and put your data there. What directory you select is up to you, but it shouldn't be part of a WAR or part of the server.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.