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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
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.
Views
Replies
Total Likes
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
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?
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
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...
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
Were you able to find a solution for this?
me too facing same isue, any help is much appriciated. Thank you.
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.
Views
Replies
Total Likes
Views
Likes
Replies