How can I access a file in WEB-INF/META-INF in a java web app?
Try using this:
URL resource=this.getClass().getClassLoader().getResource("META-INF/test.txt");
as your /META-INF is in your root path you will have to use META-INF/test.txt to access it.
And currently under WEB-INF directory I have a META-INF directory
Then you've done it wrong. Read your own quotation. It says WEB-INF/classes/META-INF.
URL resource = this.getClass().getClassLoader().getResource("test.txt");
That should be:
URL resource = this.getClass().getClassLoader().getResource("META-INF/test.txt");