开发者

Tomcat 7 and shared.loader problem

开发者 https://www.devze.com 2023-04-08 11:12 出处:网络
I am using a custom directory for properties files located at ${catalina.home}/conf/properties and in order to add it to the classpath i edited ctalina.properties and added

I am using a custom directory for properties files located at

${catalina.home}/conf/properties

and in order to add it to the classpath i edited ctalina.properties and added

shared.loader=${catalina.home}/conf/properties

But contents of this directory are not accessible when I try to read them from a listener via:

MyListener.class.getResourceAsStream("/sample.props")开发者_如何学Go

I most probably have misunderstood something here. Any help would be greatly appreciated.


Use

Thread.currentThread().getContextClassLoader()
    .getResourceAsStream("/sample.props");


Worked for me with : Thread.currentThread().getContextClassLoader() .getResourceAsStream("sample.props");

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号