AEM servlet dispatcher.forward() causing 500 error

Avatar

Avatar
Validate 1
Level 1
hungryfoolish
Level 1

Like

1 like

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile

Avatar
Validate 1
Level 1
hungryfoolish
Level 1

Like

1 like

Total Posts

7 posts

Correct reply

0 solutions
Top badges earned
Validate 1
Boost 1
View profile
hungryfoolish
Level 1

28-11-2016

Below is a weird scenario i am facing. I am having a publish instance with dispatcher in front of it.

I am using a servlet to be called from third party application with URL similar to /bin/mysevlet?id=123&action=readDetails. In this servlet i am processing based on id passed and once done, i am forwarding it to another page in AEM using below code

dispatcher=request.getRequestDispatcher(aemURL); dispatcher.forward(request, response); 

Servlet is called fine from external party and once controls comes to forward, i get below error.

Status 500

Message: org.apache.sling.api.SlingException: Exception during response processing.

Location /content/app1/en/getdetails

Parent Location/content/app1/en

Path /content/app1/en/getdetails

Referer : third party URL.

In logs i get below exception

*ERROR* org.apache.sling.servlets.post.impl.operations.ModifyOperation Exception during response processing. javax.jcr.RepositoryException: org.apache.sling.api.resource.PersistenceException: Resource at '/content/app1/en/getdetails' is not modifiable.
Caused by: org.apache.sling.api.resource.PersistenceException: Resource at '/content/app1/en/getdetails' is not modifiable.

Has anybody faced this issue. For me it seems to be case when anonymous user is not able to render page being forwarded.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile

Avatar
Coach
Employee
Jörg_Hoh
Employee

Likes

1,134 likes

Total Posts

3,161 posts

Correct reply

1,079 solutions
Top badges earned
Coach
Give back 600
Ignite 5
Ignite 3
Ignite 1
View profile
Jörg_Hoh
Employee

28-11-2016

Hi,

I guess that this request from the external party is a POST request. And when you forward this request, you end up doing a POST request to a resource. This POST request is handled by the DefaultPostServlet, which tries to write the resource, but it cannot perform this write operation due to insufficient permissions.

Please doublecheck, that the forwarding works correctly. I don't know if forwarding is the right thing if you want to respond only with the content of a page.

kind regards,
Jörg

Answers (2)

Answers (2)

Avatar

Avatar
Boost 1
Level 1
shugaika
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 1
shugaika
Level 1

Like

1 like

Total Posts

1 post

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
shugaika
Level 1

30-04-2021

I'm also facing the same issue. I have verified 2 points which Jitendra_S_Toma suggested but still not resolving the this issue. Can someone please help?

Avatar

Avatar
Validate 1
Level 7
Jitendra_S_Toma
Level 7

Likes

76 likes

Total Posts

617 posts

Correct reply

84 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile

Avatar
Validate 1
Level 7
Jitendra_S_Toma
Level 7

Likes

76 likes

Total Posts

617 posts

Correct reply

84 solutions
Top badges earned
Validate 1
Give Back 50
Give Back 5
Give Back 3
Give Back 25
View profile
Jitendra_S_Toma
Level 7

29-11-2016

Hi,

Here is the list of things which you could check to debug this problem.

  1. As @Jorg pointed out correctly, it seems you third party service is using POST method instead of GET. And forward request is trying to modify some node/resource.
  2. Ideally, forwarding a request to html page, two things need to be checked: 1-> response content type "text/html" 2-> "aemURL" should have ".html" extension.

Let me know if above points help & resolve your issue.