Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

umamaheswariy65
Level 3
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
KiranVedantam1992
Correct answer by
Community Advisor
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
smacdonald2008
Level 10
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.

mind119497
Level 2
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

Rima_Mittal
Level 4
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?

mind119497
Level 2
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

Rima_Mittal
Level 4
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...

mind119497
Level 2
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

kranthiv7238223
Level 2
Level 2

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

KiranVedantam1992
Correct answer by
Community Advisor
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

kautuk_sahni
Community Manager
Community Manager
Thank you for sharing the answer with the community. This would help others in future.