@keerthi97 you can check for the below things:
1. If on your local AEM instance, the servlet is getting resolved or not. If it is not getting resolved, you might need to check and update the "org.apache.sling.servlets.resolver.SlingServletResolver" configuration if you are having anything other than the list mentioned in the property "Execution Paths".
2. Is there any system resource resolver being used.
Map<String, Object> param = new HashMap<String, Object>(); param.put(ResourceResolverFactory.SUBSERVICE, "writeService");
ResourceResolver resolver = null;
try { resolver = resolverFactory.getServiceResourceResolver(param) } catch (Execption e){}
And then create the configuration as shown below:

And the provided the respective read permission to read the json
Reference: https://one-inside.com/aem6-resourceresolver-access-in-services/
Thanks