I've created dynamic web project in Eclipse and added it to ear project.
Image resources are placed at src\resources\
Code use resources:
@GET
@Path("bank")
@Produces("application/json")
public String getBank(@Context HttpHeaders headers) {
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("/resources/alfa.png").getFile());
String base64 = Utility.getBase64(file);
return "{\"icon\":\"" + base64 + "\"}";
}
While debugging it's OK.
When ear deployed code throws exception: java.io.FileNotFoundException: C:\apps\wildfly-8.2.0.Final\bin\content\TimerService.ear\timer.war\WEB-INF\classes\resources\alfa.png
All resources are present in war-file contained in ear-file.
What is wrong?