On AEM 6.3 we've a custom quick links search where we map keywords to outer links.
We created system user and mapped it using Apache sling Service User Mapper Service. System user is given required permissions in user admin.
We used the following code for sub service
@Activate
protected void activate() throws RepositoryException {
Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "searchService");
ResourceResolver resolver = null;
try {
resolver = resolverFactory.getServiceResourceResolver(param);
adminSession = resolver.adaptTo(Session.class);
} catch (Exception e) {
log.error("ERROR" + e + e.getStackTrace().toString());
e.printStackTrace();
}
}
We're seeing the following Null pointer during search
*ERROR* [0:0:0:0:0:0:0:1 [1513035725695] GET /bin/amica/searchServlet HTTP/1.1] com.******.adc.******com.core.search.SearchServlet ERRORjava.lang.NullPointerException[Ljava.lang.StackTraceElement;@3d05a33d
For the custom quick links we are using
public JSONArray performSearch(String queryTerm,
SlingHttpServletRequest request) throws RepositoryException,
JSONException {
String resourcePath = searchConfigurationService.getSearchQuicklinksAdminNodePath();
ResourceResolver resourceResolver = request.getResourceResolver();
Resource res = resourceResolver.getResource(resourcePath);
We can see the resourcePath through log info but unable to resolve the resource. No error logs on this.
This search working on author but not on publish, seems to be an authentication issue. Even tried using Ensure Service User for creating user and permissions.