I am trying to load a JSON file sample.json from src/main/resources directory.
I have to map that json to a Java Object. And my application is reactive, I am using Spring webflux.
I have followed Simon's Blog to come up with this:
    SimpleModule module = new SimpleModule();
    module.addDeserializer(OffsetDateTime.class, new JsonDeserializer<>() {
      @Override
      public OffsetDateTime deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return OffsetDateTime.parse(p.getValueAsString());
      }
    });
    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.registerModule(module);
    return Flux.using(() -> Files.lines(Paths.get(ClassLoader.getSystemResource("sample.json").toURI())),
        Flux::fromStream,
        BaseStream::close
    )
        .collectList()
        .map(lines -> String.join("\n", lines))
        .map(jsonContent -> {
          try {
            return objectMapper.readValue(jsonContent, MyPojo.class);
          } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
          }
        })
        .map(MyPojo::getValues());
This works fine in local but fails when running inside a docker container. (I am using gradle build to build the jar file and then build the docker image from it)
Part of the error stacktrace:
java.nio.file.FileSystemNotFoundException: null at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.getFileSystem(ZipFileSystemProvider.java:169) ~[jdk.zipfs:na] Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
 
    