Tuesday, September 29, 2015

502 Bad Gateway while accessing /libs/cq/security/userinfo.json via telnet after upgrading to AEM 6.1

We were using /libs/cq/security/userinfo.json url in BIG-IP via telnet to check the staus of the server(heartbeat check of AEM servers) to control the availablity of servers in BIG-IP.

This is working fine in AEM 5.6.1 but it stopped working after upgrading AEM to 6.1(the server status is down in BIG-IP even though the server is up).

The same URL is working fine using wget,curl command and also from browsers, only not working via telnet(This issue is only via dispatcher but it is working fine directly with publisher)

Trying 10.xxx.xxx.xxx...
Connected to 10.xxx.xxx.xxx.
Escape character is '^]'.
GET /libs/cq/security/userinfo.json
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Bad Gateway</title>
</head><body>
<h1>Bad Gateway</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
</p>
<hr>
<address>Apache/2.2.15 (Oracle) Server at xxxxxxxxxxx Port 80</address>
</body></html>
Connection closed by foreign host.

The actual root cause of the issue is the dispatcher module is not upgared as per the requirement.

The issue got resolved after upgrading the dispatcher module to latest version 4.1.10.

bash-3.2$ telnet 10.xxx.xxx.xxx 80
Trying 10.xxx.xxx.xxx...
Connected to 10.xxx.xxx.xxx.
Escape character is '^]'.
GET /libs/cq/security/userinfo.json
{"userID":"anonymous","userName":"anonymous","userName_xss":"anonymous","home":"/home/users/a/anonymous","impersonated":false,"allowedApps":[],"preferences":{}}
Connection to 10.xxx.xxx.xxx closed by foreign host.




org.apache.sling.commons.json.JSONException: Misplaced array - JSONWriter

The Misplaced array exception is thrown,While we are trying to create the JSON Array of objects from the servlet using - org.apache.sling.commons.json.io.JSONWriter.

Code:-

JSONWriter writer=new JSONWriter(response.getWriter());
try {
writer.object();
writer.key("authorName").value("test");
writer.key("biography").value("test");
writer.key("image").value("test");
writer.array();
writer.object();
writer.key("authorName").value("test");
writer.key("biography").value("test");
writer.endObject();
writer.endArray();
writer.endObject();
} catch (JSONException e) {

}

The root cause of the exception is not providing the key for initialized array(there will be different scenarios we will receive this exception)

To fix the issue as shown below in the code, add the key before starting the array.

JSONWriter writer=new JSONWriter(response.getWriter());
try {
writer.object();
writer.key("authorName").value("test");
writer.key("biography").value("test");
writer.key("image").value("test");
writer.key("list");
writer.array();
writer.object();
writer.key("authorName").value("test");
writer.key("biography").value("test");
writer.endObject();
writer.endArray();
writer.endObject();
} catch (JSONException e) {

}  

O/P

{"authorName":"test","biography":"test","image":"test","list":[{"authorName":"test","biography":"test"}]}       




Sunday, September 27, 2015

java.lang.NullPointerException:null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298)

The components are not listed in sidekick and the sidekick is empty while opening the pages in author with the following exception.


 26.09.2015 07:29:40.868 *ERROR* [10.194.0.83 [1443270580848] GET /libs/wcm/core/content/pageinfo.json HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable
java.lang.NullPointerException: null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) at com.adobe.granite.workflow.core.WorkflowSessionFactory.getWorkflowSession(WorkflowSessionFactory.java:326) at com.adobe.granite.workflow.core.WorkflowSessionFactory.getAdapter(WorkflowSessionFactory.java:461) at org.apache.sling.adapter.internal.AdapterManagerImpl.getAdapter(AdapterManagerImpl.java:147)
 at com.day.cq.workflow.impl.CQWorkflowService.getWorkflowSession(CQWorkflowService.java:148) at com.day.cq.wcm.core.impl.DefaultPageStatusProvider.updatePageInfo(DefaultPageStatusProvider.java:155) at com.day.cq.wcm.core.impl.servlets.PageInfoServlet.doGet(PageInfoServlet.java:188)
 at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet.java:269) at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:345)
 at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.java:376)
 at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:533)        at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilterChain.java:44)

The actual root cause of the issue is the workflow super user group configured in /apps/system/config/com.adobe.granite.workflow.core.WorkflowSessionFactory.config is not available in the system.     

cq.workflow.superuser=["admin","administrators","workflow-superuser"]
cq.workflow.workspace="crx.default"
adapter.condition="If\\\ the\\\ ResourceResolver\\\ is\\\ a\\\ JcrResourceResolver\\\ or\\\ a\\\ Session."
cq.workflow.models="/etc/workflow/models"
cq.workflow.instances="/etc/workflow/instances"
cq.workflow.job.retry=I"3"
granite.workflow.inboxQuerySize=I"2000"


The issue got resolved after creating the user group(workflow-superuser) in the system with the required workflow permissions.



Thursday, September 24, 2015

Taxonomy/Tag issue after upgrading to AEM 6.1

Taxonomy/Tags are used for search purpose. These tags are used by external search tool to provide the details.

Issue being discussed here is about the Meta tags not being displayed.


This issue is expected to be seen after upgrading the environment to AEM 6.1 version and the root cause is due to change in the user permission.

To resolve this issue provide the required permissions, go to Useradmin. Give permission (Read, Modify, Create, Delete, and Replicate) to /etc/tags folder for the group everyone.

Only Read access is sufficient for publisher instance.



Soon after the permission is given the Issue will be resolved, and you can see the tags appearing as shown in the screen shot.




Posted By

Sunag. M.S
sunageinstein@gmail.com



Thursday, September 17, 2015

a:ActionNotSupported: The message with Action '"' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher.

Getting the below error while invoking the SOAP service via WebServiceTemplate.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<s:Fault>
<faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode>
<faultstring xml:lang="en-US">The message with Action '"' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring>
</s:Fault>
</s:Body>
</s:Envelope>

The root cause of the issue is the SOAPAction is not set in the request header while invoking the service.

To fix the issue set the SOAPAction specified in the WSDL binding while invoking the service.

  <binding name="binding" type="service">
    <binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <operation name="process">
      <operation soapAction="process" style="document"/>
      <input>
        <body namespace="request" use="literal"/>
      </input>
      <output>
        <body namespace="response" use="literal"/>
      </output>
    </operation>
  </binding>

webServiceTemplate.marshalSendAndReceive(url,request, new WebServiceMessageCallback() {

    public void doWithMessage(WebServiceMessage message) {
        ((SoapMessage)message).setSoapAction("process");
    }
});



Upgrading AEM/Adobe CQ5 5.6.1 to AEM/Adobe CQ5 6.1

Upgrading AEM/Adobe CQ5 5.6.1 to AEM/Adobe CQ5 6.1



Contact Form

Name

Email *

Message *