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

500, 504 service errors on ajax calls

Avatar

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile
sreenu539
Level 4

25-04-2018

Hi,

I have an AEM servlet which in turn call google recaptcha web service.

Application makes an ajax call to AEM Servlet and google recaptcha inside the servlet.

Sometimes, google recaptcha server is not reachable and code is throwing HttpHostConnectException ( connection timeout, 500 , 504 service errors thrown) and application hangs.

I do have catch block with IOException and I do see logs with exception stacktrace.

Question :  Why does application hangs, even though I am handling the exception?

Question : Is there any way to come out of this and let the application flow , rather than hang ( on front end ajax call or on AEM Server level configuration ??)

Thanks,

Sri

Replies

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 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,406 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

26-04-2018

How are you maknig the call to the Google Service - is this a Rest call? Are you using Java HTTP APIs?

See this articles as en example of calling a Google Restful service -- Creating an Adobe Experience Manager 6.3 HTL Component that displays data from a Restful Web Service

Avatar

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile
sreenu539
Level 4

26-04-2018

Using Apache HttpClient api. Yes google service is a rest service.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 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,406 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

26-04-2018

I just tested a call to Google Service - by following the article listed above. It works nicely.

Client.png

If the endpoint is down or not responsive - you have to handle that in your logic.  THis specific endpoint is up and as you can see - it returns the value - where we write it out in HTL.

As a side note here - we are updating this use case to AEM 6.4 as well.

Avatar

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile

Avatar
Validate 10
Level 4
sreenu539
Level 4

Likes

7 likes

Total Posts

158 posts

Correct Reply

1 solution
Top badges earned
Validate 10
Validate 1
Ignite 5
Ignite 3
Ignite 20
View profile
sreenu539
Level 4

26-04-2018

Using Apache HttpClient api. Yes google service is a rest service. I need to know when httplcient.execute happens and service connection is taking indefinite time, then connection times out and application hangs with 5xx error responses in ajax. How to handle this scenario at AEM server level or service side or ajax side , so that application does not stay in loading state forever.

Avatar

Avatar
Validate 25
Level 10
smacdonald2008
Level 10

Likes

1,406 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,406 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

30-04-2018

If the code that calls this is Java, then handle it. This is more of a Java question then an AEM question:

Java HTTP Client Request with defined timeout - Stack Overflow