Servet not getting resolved | Community
Skip to main content
pallavis8124480
Level 3
January 31, 2018
Solved

Servet not getting resolved

  • January 31, 2018
  • 11 replies
  • 3817 views

Hi ,
I tried to create a sample servlet in aem 6.3 .


Please see below for the piece of code :

// all the import statements

@SlingServlet(

paths={"/bin/customservlet"}

)

public class Test extends SlingAllMethodsServlet {

private static final long serialVersionUID = 1L;

protected static final Logger LOGGER = LoggerFactory.getLogger(Test.class);

    @Override

    protected void doGet(SlingHttpServletRequest request, SlingHttpServletResponse response) throws ServletException, IOException {

    LOGGER.info("ENTERED THE SERVLET");

    }  

}

When I am trying to hit the servlet using locahost:4502/bin/customservlet  - it is giving the following message 

Resource at '/bin/customservlet' not found: No resource found

RequestURI=/bin/customservlet

Servlet= /apps/sling/servlet/errorhandler/404.html

I am not sure why  I am getting this error.I checked error logs as well which is giving the following error :

31.01.2018 11:01:08.475 *INFO* [0:0:0:0:0:0:0:1 [1517376668472] GET /bin/customservlet HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /bin/customservlet not found

31.01.2018 11:01:08.478 *ERROR* [0:0:0:0:0:0:0:1 [1517376668472] GET /bin/customservlet HTTP/1.1] org.apache.sling.servlets.resolver.internal.SlingServletResolver Calling the error handler resulted in an error

java.lang.Error: Unresolved compilation problems:

Only a type can be imported. com.adobe.cq.sightly.WCMUse resolves to a package

WCMUse cannot be resolved to a type

The method activate() of type ResponseStatus must override or implement a supertype method

The method getResponse() is undefined for the type ResponseStatus

at apps.sling.servlet.errorhandler.ResponseStatus.<init>(ResponseStatus.java:18)

Please let me know how I will be able to resolve it.

Thanks,

Pallavi

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Feike_Visser1

Can you the OSGi annotations?

Example here: htl-examples/SimpleServlet.java at master · heervisscher/htl-examples · GitHub

11 replies

Feike_Visser1
Adobe Employee
Adobe Employee
February 2, 2018

Can you build this project: GitHub - heervisscher/htl-examples: AEM HTL examples and compare?

What version do you have of this plugin?

                <plugin>

                    <groupId>org.apache.felix</groupId>

                    <artifactId>maven-bundle-plugin</artifactId>

                    <version>3.3.0</version>

                    <inherited>true</inherited>

                </plugin>