I use code like:
Thread currentThread=Thread.currentThread();
ClassLoader classLoader=currentThread.getContextClassLoader();
InputStream configFile=classLoader.getResourceAsStream("config.xml");
But this code starts to work after 2 - 3 hours. I didn't nothing - only restart, clean, deploy, etc.
I suppose that old jar/class that cannot find file config.xml was in some cache - may be in cache of tomcat or in cache of OS/VM. Does it possible? Thanks.
Unfortunately i can't make comments i dont have 50 reputation yet so i will just write my comment into this answer,
Can you explain more about the code? What tool do you use to prepare the code? How do you deploy it ? My assumption is that if you "only" make a restart, clean and after a deploy it will not work, do it the other way, clean, deploy, restart. If you give more information, i can give you a better answer.
What you can try to do is delete the application cache or set the caching off if you believe its a caching issue
cachingAllowed="false" in confg/context.xml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.