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

maven build generating an empty jar

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

17-02-2018

Hello,

I am starting with sling, and I am following an adobe tutorial to build a simple slingServlet using resourceType

My code is very simple, but seems to being ignored.

I was noting that when I do the maven build of the bundle, I am receiving the warning below but I am having success message on the process:

[WARNING] Bundle xxxxxx:xxxxx.core:bundle:1.0-SNAPSHOT : The JAR is empty: The instructions for the JAR named xxxxxx.core did not cause any content to be included, this is likely wrong

When I decompiled my jar, it has inside only the pom.xml, pom.properties and manifest,mf,

My packages strangely are not on the generated jar archive.

Has someone faced this same problem or has some idea of what this could be?

Thank you,

jessica

Replies

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

17-02-2018

Hi,

I would abble to resolve the jar problems, mas my servlet is still getting ignore.

My bundle is active, so I don't know what more should I have to do.

I just have this class, I am trying to access it with /content/my-website/my-page.groups.html

but it is not working

This is what I have for now:

@SlingServlet(methods = {"GET"},

metatype = true,

resourceTypes = {"resource/myresource"},

selectors = {"groups"})

public class ChangeURLServlet extends SlingAllMethodsServlet{

private static final long serialVersionUID = 2598426539166789515L;

   

    private static final Logger log = LoggerFactory.getLogger(ChangeURLServlet.class);

   

    @Override

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

      

     try

     {

         PrintWriter out = response.getWriter();

         out.println("<html><body>");

         out.println("<h1>This value was returned by an AEM Sling Servlet bound by using a Sling ResourceTypes property</h1>");

         out.println("</html></body>");

         response.getWriter().write("it called the servlet!");

     }

     catch(Exception e)

     {

         log.info(e.getMessage(),e);

     }

   }

}

Avatar

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

158 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile

Avatar
Validate 25
MVP
Ratna_Kumar
MVP

Likes

158 likes

Total Posts

755 posts

Correct Reply

134 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give Back 50
Give Back 5
View profile
Ratna_Kumar
MVP

17-02-2018

Hi,

I hope you have followed our HELPX article: Adobe Experience Manager Help | Binding Adobe Experience Manager Servlets to ResourceTypes properly

I have done this many times but I didn't encountered this issue. When I try to access the page as per article http://localhost:4502/content/submitPage.groups.html , the servlet is called for me.

Thanks,

Ratna Kumar.

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

18-02-2018

Yes! is this article that I am following, it seems very simple, but when I try on my application, nothing happens.

One different that I noted is that the jar that is being generated on the article has one thing more that is a package called metatype.

When I generate and decompile my jar, it does not has this package metatype.

I don't know if I am missing some configuration.

1421802_pastedImage_2.png

thanks for your help!

Avatar

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
jessicag5141490
Level 1

Likes

0 likes

Total Posts

8 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
jessicag5141490
Level 1

18-02-2018

Another thing that I am seeing is that when I create a page the resourceType of the page is, for example,

website/components/structure/pages/mypage I am using this original resourceType and the page works fine, but does not call the servlet.

If I try to change this resourceType for another name random, the page does not work and I have the error below:

org.apache.sling.servlets.get.impl.DefaultGetServlet No renderer for extension html, cannot render resource JcrNodeResource, type=bin/pages/mypage, superType=null,

I don't know what can I try anymore