Friday, December 18, 2015

How to configure Caching algorithm for better performance in Hybris platform?

How to configure Caching algorithm for better performance in Hybris platform?

In local.properties file add/change the values of the following properties.

#Possible vales are FIFO(default), LRU and LFU. Default value is FIFO
cache.evictionpolicy=FIFO
#Possible vales are FIFO (default), LFU and LRU. Default value is FIFO
regioncache.entityregion.evictionpolicy=FIFO

#Possible vales are FIFO (default), LFU and LRU. Default value is FIFO
regioncache.typesystemregion.evictionpolicy=FIFO

#Possible vales are FIFO (default), LFU and LRU. Default value is FIFO
regioncache.querycacheregion.evictionpolicy=FIFO

Change the algorithm to either LFU or LRU based on your requirements for better performance.


How to disable all the cron jobs in Hybris platform?

How to disable all the cron jobs in Hybris platform


In local.properties file change the cronjob.timertask.loadonstartup property to false

cronjob.timertask.loadonstartup=false

Add the property if it is not there already.

This flag will not allow the system to start the cron jobs automatically after server restart.


Saturday, December 12, 2015

Issue with migrating BPEL from Orace SOA 11g to Oracle SOA 12C - An unexpected Server error has occurred in JDeveloper

Issue with migrating  BPEL from Orace SOA 11g to Oracle SOA 12C - An unexpected Server error has occurred in JDeveloper

Issue:

Trying to migrate some composites from Oracle SOA 11.1.1.5 to 12c. But after I load the project in JDeveloper 12c, its throwing the error "An unexpected Server error has occurred in JDeveloper" and its giving the options like 1)"save all files and exit" 2) Exit without saving 3) continue.

Selected “continue" option and after that tried opening "*.BPEL" file and its completely blank and also all the wires were disappeared from "Composite.xml".

1) Open your SOA project in JDeveloper version 11.1.1.5 and create the SAR ( deployable ) file into your deploy folder. ( Ex: scaSample_rev001.jar )

2) Close the JDeveloper 11.1.1.5 and now open JDeveloper 12c ,

3) File -> Import -> select "SOA Archive Into SOA Project" -> OK -> Next -> Composite Archive Browse to the above SAR file created ( Ex: scaSample_rev001.jar )

4) The composite.xml  and BPEL file will show the content now


Extension function error: Method not found 'setFlowInstanceTitle – Oracle SOA 12C(12.1.3)

Extension function error: Method not found 'setFlowInstanceTitle – Oracle SOA 12C(12.1.3)

We were getting the below exception while trying to set the title for composite instance in 12.1.3

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/<https://urldefense.proofpoint.com/v2/url?u=http-3A__schemas.xmlsoap.org_soap_envelope_&d=AwMFAw&c=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q&r=8qQMQBAbDh32F7DyV0m3CH9kXdKLrWigXrO0p0cWQEir0H7fTd2J8_NC1cElkvWv&m=dRon_z2evK4VjWGP0oY9FibkrtcDAvecx7CgL26qjC0&s=7zNuyckO1P0yz595V1RJcVFjt7td9IRnkJf6OEWgRdE&e=>">
  <env:Header>
     <tracking:faultId xmlns:tracking="http://oracle.soa.tracking.core.TrackingProperty<https://urldefense.proofpoint.com/v2/url?u=http-3A__oracle.soa.tracking.core.trackingproperty_&d=AwMFAw&c=4ZIZThykDLcoWk-GVjSLm9hvvvzvGv0FLoWSRuCSs5Q&r=8qQMQBAbDh32F7DyV0m3CH9kXdKLrWigXrO0p0cWQEir0H7fTd2J8_NC1cElkvWv&m=dRon_z2evK4VjWGP0oY9FibkrtcDAvecx7CgL26qjC0&s=DwqbKOWHhDFBuDf9yc8Ur29O_D7KfSBO_exS-pWTjNE&e=>">10002</tracking:faultId>
  </env:Header>
  <env:Body>
     <env:Fault>
        <faultcode>env:Server</faultcode>
        <faultstring>An error occurs while processing the XPath expression; the expression is oraext:setFlowInstanceTitle("Title").</faultstring>
        <faultactor/>
        <detail>
           <exception>XPath expression failed to execute.
An error occurs while processing the XPath expression; the expression is oraext:setFlowInstanceTitle("Title").
The XPath expression failed to execute; the reason was: Extension function error: Method not found 'setFlowInstanceTitle'.
Check the detailed root cause described in the exception message text and verify that the XPath query is correct.</exception>
        </detail>
     </env:Fault>
  </env:Body>
</env:Envelope>


To resolve the issue apply the patch with no 18310693.


Sunday, December 6, 2015

Configuring same short URL/Vanity URL for different sites with https – AEM/Adobe CQ5

This post will explain how to configure same short URL/Vanity URL for different sites that is accessible through https in Adobe CQ5/AEM.

Recently we had a scenario to be implemented, two different websites needs to be accessed with same URL and with https protocol.
e.g
https://example1.com/en.html
https://example2.com/en.html

Both the sites are mapped to different nodes as below

https://example1.com/en.html  --> /content/example1/en
https://example2.com/en.html --> /content/example2/en

Create the redirect rules in dispatchers, inside the corresponding virtual host (httpd.conf) to redirect the http request to https and to shorten the URL’s .

RewriteRule ^/content/example1/(.*)$  /$1 [NE,L,R=301]

RewriteCond %{HTTPS} off
RewriteRule ^/$ https:// example1.com/en.html
RewriteRule ^/en.html https:// example1.com/en.html
RewriteRule ^/en/(.*)$ https:// example1.com/en/$1

Repeat the same for example2.com and for all the dispatchers.

Mapping in publisher :

Go to <<AEM Publisher Host>>:4503/system/console/configMgr with admin credentials. Search for Apache Sling Resource Resolver, and change the value of mapping location from /etc/map to /etc/map.publish




Sunday, October 4, 2015

Upgrading the dispatcher module in Adobe Experience Manager(AEM)

Upgrading the dispatcher module in Adobe Experience Manager(AEM)

Download the required dispatcher module version from the following URL 

https://www.adobeaemcloud.com/content/companies/public/adobe/dispatcher/dispatcher.html 

Extract the dispatcher module 

tar -xvzf <dispatcher-xxxxxxxx.tar.gz> (linux) 

Copy the extracted dispatcher-xxxxxxxxxx.so file to the module folder of the server. 



Modify the /etc/httpd/conf/httpd.conf file - remove the previous dispatcher module and add the new version. 



Saturday, October 3, 2015

Server startup failed (FAILED_NOT_RESTARTABLE) with ORA-01882: timezone region not found error - Oracle SOA 12C

Server startup failed (FAILED_NOT_RESTARTABLE) with ORA-01882: timezone region not found error - Oracle SOA 12C

The server startup failed and the status changed to "FAILED_NOT_RESTARTABLE" with the following error. 

Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException 
Internal Exception: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 
ORA-01882: timezone region not found 

Error Code: 604 
        at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:331) 
        at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:326) 
        at org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:138) 
        at org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162) 
        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.setOrDetectDatasource(DatabaseSessionImpl.java:204) 
        at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:741) 
        at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:239) 
        at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:685) 
        ... 93 more 
Caused by: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 
ORA-01882: timezone region not found 

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:466) 
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399) 
        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:391) 
        at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1126) 
        at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:507) 

The root cause of the issue is, the server not able to get the time zone configuration 
To fix the issue add "-Duser.timezone=UTC" to the server startup parameters - change the timezone with the value supported by database server, 





ADFC-0619: Authorization check failed: User 'weblogic' does not have 'VIEW' permission on 'jsf.resourcesPageDef'. - Oracle SOA 12C

ADFC-0619: Authorization check failed: User 'weblogic' does not have 'VIEW' permission on 'jsf.resourcesPageDef'. - Oracle SOA 12C

We were receiving the following exception while accessing the OSB console in Oracle SOA 12C.

[2014-10-15T09:18:45.702-04:00] [AdminServer] [ERROR] [] [oracle.help.web.rich.OHWFilter] [tid: [ACTIVE].ExecuteThread: '21' for queue: 'weblogic.kernel.Default
(self-tuning)'] [userId: weblogic] [ecid: bf088c45-bbd9-4379-a8f7-4e3fb8639324-0000017d,0] [APP: service-bus] [DSID: 0000K^JuMDh0ZrALnax0iZ1KFb1b000003] ADFC-0619: Authorization check failed: User 'weblogic' does not have 'VIEW' permission on 'jsf.resourcesPageDef'.[[
oracle.adf.controller.security.AuthorizationException: ADFC-0619: Authorization check failed: User 'weblogic' does not have 'VIEW' permission on 'jsf.resourcesPageDef'.
  at oracle.adf.controller.internal.security.AuthorizationEnforcer.handleFailure(AuthorizationEnforcer.java:198)
  at oracle.adf.controller.internal.security.AuthorizationEnforcer.internalCheckPermission(AuthorizationEnforcer.java:166)
  at oracle.adf.controller.internal.security.AuthorizationEnforcer.checkPermission(AuthorizationEnforcer.java:120)


This is caused by using an incorrect JDK version(1.8).
All Fusion Middlleware 12.1.3 products will run on JDK 1.7.55+ version.

To fix the issue downgrade the JDK to supported version.

Downgrade the JDK:

Change all the JDK location referred in the following paths:

<<Middleware_Home>>/Oracle_Home/user_projects/SOA_domain/bin/setDomainEnv.sh

<<Middleware_Home>>/Oracle_Home/oracle_common/common/bin/commEnv.sh

<<Middleware_Home>>/Oracle_Home/user_projects/SOA_domain/nodemanager/nodemanager.properties

Restart the servers.


Friday, October 2, 2015

ORA-01882: timezone region not found while creating schemas through RCU utility - Oracle SOA 12C

 ORA-01882: timezone region not found while creating schemas through RCU utility - Oracle SOA 12C

We were receiving the following exception while running the RCU Utility to create the required schema's in Oracle SOA 12C

ORA-01882: timezone region not found while creating schema's through RCU utility - Oracle SOA 12C


This can be resolved by setting the TZ environment variable before starting the RCU Utility with the supported Timezone of database machine

e.g.

export TZ='UTC'
echo $TZ

Restart the RCU utility.


Node Manager startup fails in Oracle SOA 12C

Node Manager startup fails in Oracle SOA 12C

The Node Manager failed to start in Oracle SOA Suite 12C with the following error.

[Sat Nov 09 01:29:46 2013] [I] [RunJavaApp] Invoking main class
<Nov 9, 2013 1:29:47 AM GMT> <INFO> <Loading domains file:
C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\nodemanager
\nodemanager.domains>
<Nov 9, 2013 1:29:50 AM GMT> <INFO> <Loading identity key store:
FileName=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\nodemanager\security\DemoIdentity.jks, Type=jks, PassPhraseUsed=true>
<Nov 9, 2013 1:29:50 AM GMT> <SEVERE> <Fatal error in NodeManager server> weblogic.nodemanager.common.ConfigException: Identity key store file not found:
C:\Oracle\Middleware\Oracle_Home\user_projects\domains\base_domain\nodemanager\security\DemoIdentity.jks
at weblogic.nodemanager.server.SSLConfig.loadKeyStoreConfig(SSLConfig.java:170)

The actual root cause of the problem is the jks file is not configured properly for nodemanager.

To fix the issue:-

Copy the file <domainhome>\security\DemoIdentity.jks to  <domainhome>\nodemanager\security\DemoIdentity.jks


Tuesday, September 29, 2015

502 Bad Gateway while accessing /libs/cq/security/userinfo.json via telnet after upgrading to Adobe Experience Manager(AEM) 6.1

502 Bad Gateway while accessing /libs/cq/security/userinfo.json via telnet after upgrading to Adobe Experience Manager(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 Adobe Experience Manager(AEM) servers) to control the availablity of servers in BIG-IP.

This is working fine in Adobe Experience Manager(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

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"}]}       



Saturday, September 26, 2015

java.lang.NullPointerException:null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) - AEM/Adobe CQ5

java.lang.NullPointerException:null at com.adobe.granite.workflow.core.WorkflowSessionFactory.isSuperUser(WorkflowSessionFactory.java:298) - AEM/Adobe CQ5

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 Adobe Experience Manager(AEM) 6.1

Taxonomy/Tag issue after upgrading to Adobe Experience Manager(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 Adobe Experience Manager(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.



Thursday, September 17, 2015

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

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 version 5.6.1 to AEM/Adobe CQ5 version 6.1

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



Wednesday, August 5, 2015

java.lang.RuntimeException: ConfigurationManagerImpl disabled : Adobe CQ5/Adobe AEM 6.1

java.lang.RuntimeException: ConfigurationManagerImpl disabled : Adobe CQ5/Adobe AEM 6.1

We are receiving the the following exception after upgrading Adobe CQ5/Adobe AEM 5.6.1 to Adobe CQ5/Adobe AEM 6.1.

org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught SlingException - java.lang.RuntimeException: ConfigurationManagerImpl disabled

Because of this the components are not able fetch the configuration details and failed to render.

The root cause of the issue is ConfigurationManagerImpl OSGI component is not enabled(default it will be disabled for security).

The issue got resolved after enabling the same.

The following steps can be followed to enable ConfigurationManagerImpl.

Login to system console - http://localhost:4502/system/console/components
Search for ConfigurationManagerImpl



Click on configure
Select Enabled and Save the configuration.




Sunday, July 5, 2015

BEA-382510:javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Content is not allowed in prolog.

BEA-382510:javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Content is not allowed in prolog.

We were getting the below exception(BEA-382510) intermittently in OSB assign activity in run time.

OSB Assign action failed updating variable "var1": javax.xml.transform.TransformerException: com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: Content is not allowed in prolog.


This is the known issue in SOA Suite 11.1.1.5.0 version and fixed from 11.1.1.6.0.

The issue got fixed in 11.1.1.5.0 version after installing the patch 10086559.



Friday, July 3, 2015

Internationalization i18n labels are not displaying: Adobe CQ5/Adobe AEM

Internationalization i18n labels are not displaying: Adobe CQ5/Adobe AEM.

We were facing the issue with displaying  the ii18 labels in Adobe Experience Manager(AEM) pages, the key is getting displayed instead of the message.

<fmt:message key="login"/>

The key "login" is displayed as label instead of the message "Login".

The root cause of the issue is, the bundle "Apache Sling Internationalization Support (org.apache.sling.i18n)" is in resolved state.

The issue got resolved after restarting the "Apache Sling Internationalization Support (org.apache.sling.i18n)" bundle.




Wednesday, July 1, 2015

Programatically Set/Get the metadata of an Asset: Adobe CQ5/Adobe AEM

Programatically Set/Get the metadata of an Asset: Adobe CQ5/Adobe AEM

The Adobe Experience Manager(AEM) version referred here is 5.6.1

@Reference
private ResourceResolverFactory resolverFactory;

ResourceResolver resourceResolver =null;
try
{
String resourcePath = "/content/dam/geometrixx-outdoors/banners/adventure.jpg";
resourceResolver= resolverFactory.getAdministrativeResourceResolver(null);
   Resource res = resourceResolver.getResource(resourcePath);
   
   Resource metadataRes =res.getChild("jcr:content/metadata");
   ModifiableValueMap map = metadataRes.adaptTo(ModifiableValueMap.class);
     
   //set metadata
   map.put("dc:samplemetadata", "sample metadata");
   resourceResolver.commit();
     
   //get metadata  
   String metadata=map.get("dc:samplemetadata").toString();  
     
}catch(Exception e)
{

}finally
{
resourceResolver.close();
}



Dependency in pom.xml

<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.4.0</version>
<scope>provided</scope>
</dependency>


Tuesday, June 30, 2015

How to enable Debugging for OSB modules

How to enable Debugging for Oracle Service Bus(OSB) modules

Make sure server log is set to debug (Weblogic console -> Environment-->Servers -><<OSB Server>>--> Logging -> Advanced)

Stop the servers .
Open file <DOMAIN_HOME>/alsbdebug.xml
Set the value to true for the required modules.


Open file <DOMAIN_HOME>/configfwkdebug.xml
Set the value to true for the required modules.


Restart the server
Server log will have the details.