简体   繁体   中英

Load Properties or XML in glassfish web service

I've got a basic glassfish web service and I'm trying to load some properties from WEB-INF folder. However,

Thread.currentThread().getContextClassLoader().getResource("test.properties") this.getClass().getResource("test.properties");

don't seem to be searching in the right directories. Replacing test.properties with ".", i get the directory file:/C:/Program%20Files%20(x86)/glassfish-3.1.2/glassfish/domains/domain1/lib/classes/ which is completely empty.

How do i load property files from the java layer in a web service like this?

将其放在WEB-INF / classes中并要求输入“ /test.properties”

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM