Following best practices, I\'m using Thread.currentThread().getContextClassLoader().getResourceAsStream
to load resources in a web application (like text files or x
Try this:
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
URL resURL = ctxLoader.getResource(resName);
URLConnection resConn = resURL.openConnection();
resConn.setUseCaches(false);
InputStream resIn = resConn.getInputStream();
...
i finally solved this problem by change the jar file name, every time i change the resource content, i change a new name with current timestamp
In addition to kschneid's answer which might work for Tomcat indeed, I wanted to add that for JBoss AS 5+ it already seems to work without needing any special tricks.
Caching of resources is probably class loader specific. The JBoss AS one either doesn't cache or is smart enough to see that the resource on disk has changed.