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

6.4 JCR data using the QueryBuilder API tutorial trouble

Avatar

Avatar
Validate 1
Level 1
michaelc1891139
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
michaelc1891139
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

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

15-05-2019

Hi Experts,

I've been following the "Querying Adobe Experience Manager 6.4 JCR data using the QueryBuilder API" tutorial.

Adobe Experience Manager Help | Querying Adobe Experience Manager 6.4 JCR data using the QueryBuilde...

I'm currently using AEM 6.5 and I create the project using archetype version 18 and not 13.

However I've been having trouble with the Sling servlet, I've pretty much followed the tutorial exactly.

The get Employees button in the HTL sends a JQuery AJAX request to post data to a Sling Servlet.

The path which I set in the servlet is:

@Component(service=Servlet.class,

property={

        Constants.SERVICE_DESCRIPTION + "=Simple Demo Servlet",

        "sling.servlet.methods=" + HttpConstants.METHOD_GET,

        "sling.servlet.paths="+ "/bin/myCustData"

   })

I try to access this servlet by:

$.ajax({

type: 'GET',   

url:'/bin/myCustData',

data:'type=' + 'data',

success: function(msg){

var xml = msg;

var oTable = $('#myTable').dataTable();

oTable.fnClearTable(true);

//Loop through this function for each Employee element in the returned XML

$(xml).find('Employee').each(function(){

                         

            var $field = $(this);

            var Name = $field.find('Name').text();

            var Job = $field.find('Position').text();

            var Address = $field.find('Address').text();

            var Age = $field.find('Age').text();

            var Date = $field.find('Date').text();  

            var Salary = $field.find('Salary').text();    

            //Set the new data

        oTable.fnAddData( [

                Name,

                Job,

                Address,

                Age,

                Date,

                Salary,,]

            );

            });

       }

});

However I'm getting the error below.

*INFO* [0:0:0:0:0:0:0:1 [1557972332514] GET /bin/myCustData HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Resource /bin/myCustData not found

The QUeryJCR64 - CoreQUeryJCR64.core bundle is active and the servlet is being registered. But there is no path field showing?

service.PNG

Any clues on what might be the problem would be appreciated,

Thank you,

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Boost 5
Level 2
PriyankaBiswal
Level 2

Likes

8 likes

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Boost 5
Level 2
PriyankaBiswal
Level 2

Likes

8 likes

Total Posts

11 posts

Correct Reply

2 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Affirm 1
View profile
PriyankaBiswal
Level 2

15-05-2019

Hi ,

pointers below might help you debug.

1. Check if your servlet is being Resolved http://localhost:4502/system/console/servletresolver , Give your Servlet path and see what is the serving url.

2. Check  if the OSGI Component is Active or not, An osgi component may not be in active state if all its references are not satisfied.

Go to  http://localhost:4502/system/console/components , Search with fully qualified name of your Osgi Component e.g

com.adobe.cq.account.api.AccountManagementService

3. You can check if  your Servlet path is allowed in Apache Sling Servlet/Script Resolver and Error Handler

Answers (1)

Answers (1)

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,408 likes

Total Posts

12,671 posts

Correct Reply

2,278 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Give back 900
Give back 600
View profile
smacdonald2008
Level 10

16-05-2019

As you pointed out that was for AEM 6.4 and tested on that version. I am not sure if something would need to be modified to work on AEM 6.5 and Maven Arch 18.