I want to read/load a JSON file from another module's /resources directory to the current module and map the JSON using jackson.
Current module name is "transform" and the resource file that I need is in another module named "schema". I have added "schema" as a maven dependency in the pom.xml file of the "transform" module.
I need to read/load a file named "example.json" in the "schema" module.
But I keep getting the following error:
com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input.
What I have so far:
Map<String, String> map = objectMapper.readValue(
getClass().getClassLoader().getResourceAsStream("/schema/resources/example.json"),
new TypeReference<Map<String, String>>(){});
Let's just say the full path to example.json is "/schema/resources/example.json".