I have a web application which has following structure (partial).
Project Name src/main/java com.package MainFile.java src/main/resources
This file is in the web app classpath, so you can get it like:
Path path = Paths.get(getClass().getResource("/sample.xml").toURI()); return new String(Files.readAllBytes(path));