Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ClassLoader.getSystemResourceAsStream not working when running on tomcat

Tags:

java

tomcat

gwt

I am loading a configfile using ClassLoader.getSystemResourceAsStream. The file is placed in the src folder of my GWT application. It ends up in war/WEB-INF/classes. I copy the war folder to tomcat under webapps/MyApp. When running the application, getSystemResourceAsStream throws an exception. When running under Jetty it works fine.

like image 914
Alex Avatar asked Oct 22 '25 16:10

Alex


1 Answers

Try:

getClass().getClassLoader().getResourceAsStream();

It will definitely work; I also had same type of problem. This question describes why you are having that problem.

like image 108
Ankit Avatar answered Oct 24 '25 05:10

Ankit



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!