Я имею немного проблемы с моим кодом и что он всегда бросает NullPointerException
:getResourceAsStream всегда возвращается нуль (Google App Engine)
public class WhateverResource extends ServerResource {
@Get("json")
public Representation represent(){
InputStream is = getContext().getClass().getClassLoader().getResourceAsStream("/whatever.properties");
Properties props = new Properties();
try {
props.load(is); // NPE here!
String whatever = props.getProperty("whatever_key");
setStatus(Status.SUCCESS_OK);
} catch (IOException e) {
e.printStackTrace();
setStatus(Status.SERVER_ERROR_INTERNAL);
}
return new StringRepresentation(props.toString());
}
}
Я проверить genererated файл WAR и в целевой папке есть файл properties
под WEB-INF
папка. Что может быть неправильным с этим кодом?