I have some data files in my WebApplication which I want to read.
How can I access them from an EJB?
I tried something like this but it didn't work:
@Singleton
public class Server {
public void loadData() {
InputStream is =
this.getClass().getClassLoader().
getResourceAsStream("WebContent/WEB-INF/Data/Data.xml");
//read from is...
}
}
Or is there any better way to handle read-only data files? I don't want to use a database, because I never have to write into these files, and I can parse big XML files very easily.