Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

com.day.cq.wcm.core.impl.components.ComponentCacheImpl Requested Path xxxxx.servlet is not in available search paths

Avatar

Level 3

Servlet everything looks good but not able to access the servlet after this warning it throwing the exception

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable

javax.servlet.ServletException: Not a Sling HTTP request/response

Any ideas why this is happening.

Thanks In Advance.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Just check the sling servlet method that you declared in component annotation and the method that is utilized in the class body. I declared METHOD_GET in component annotation and using doPost in the class by which I was getting the above error. Once it is corrected, the servlet started responding.

View solution in original post

10 Replies

Avatar

Level 10

Looks like you may not have registered it properly. Are you registering it by resource. Can you show the code you are using to reg the servlet.

Avatar

Level 2

Thanks for the reply.

Here is the code for the servlet

@SlingServlet(paths = { "/services/all-sample" }, methods = { "GET", "POST" })
public class xxxxxxxx extends SlingAllMethodsServlet {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(xxxxxxxxx.class);

@Override
protected final void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response)
   throws ServletException, IOException {
  logger.info("Able to hit in");

}

@Override
protected final void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
   throws ServletException, IOException {
}

}

Have 2 bundles both activate state in console.

The same code able to access from the another bundle but trying to add servlets in the 2nd bundle. From the 2nd bundle not able to access the servlets.

Thanks

Uma

Avatar

Level 4

Hi,

1. Which version of AEM are you on?

2. Is /services/ added in execution paths(servletresolver.paths) in Apache Sling Servlet/Script resolver?

3. Do you see your servlet in an active state in OSGI components console?

Avatar

Level 2

Hi ,

using AEM 6.3 and /services path configured in servlet resolved and OSGI component is Active. I am able to access the servlet from the bundle1 with the same code.  From bundle2 not able to access.

Thanks

Uma

Avatar

Level 4

If you are using AEM 6.3, then felix annotations have to be substituted by OSGI annotations.

@SlingServlet is not allowed anymore, I am not sure how can you access the servlet from one of the bundles.

See SlingServlet Annotation here at the link Official OSGi Declarative Services Annotations in AEM - Adobe Experience Manager | AEM/CQ | Apache S...

Avatar

Level 2

That is my concern as well.

Why it is not allowing one and in another.

May be it is substituted but still can be able to access not only this one .. couple other servlets are there and using the same.

Need to figure it out what needs to be updated.

Thanks

Avatar

Level 1

Were you able to find a solution for this?

Avatar

Level 2

me too facing same isue, any help is much appriciated. Thank you.

Avatar

Correct answer by
Community Advisor

Just check the sling servlet method that you declared in component annotation and the method that is utilized in the class body. I declared METHOD_GET in component annotation and using doPost in the class by which I was getting the above error. Once it is corrected, the servlet started responding.

Avatar

Administrator
Thank you for sharing the answer with the community. This would help others in future.


Kautuk Sahni