Friday, August 29, 2014

How to create Repository Nodes thorough Java API in Adobe Experience Manager(AEM)

How to  create Repository Nodes thorough Java in Adobe Experience Manager(AEM)

We can create the repository nodes inAdobe Experience Manager(AEM) through Java API , the below code snippet will help us to create the nodes in Adobe Experience Manager(AEM).

private static final String BASE_PATH = "/etc/commerce/products"; // the folder under which the nodes should be created

//Get the Resource resolver from request - Creating the node through Servlet
ResourceResolver resolver = request.getResourceResolver();

//Get the Resource resolver through resolver factory - Creating the node through Service
@Reference
private ResourceResolverFactory resolverFactory;//Get the resolverFactory reference in the service

ResourceResolver resolver = resolverFactory.getAdministrativeResourceResolver(null);//Get the resolver

//Get the session
Session session = resolver.adaptTo(Session.class);

//Create the Node
Node node = JcrUtil.createPath(BASE_PATH+<<Node Name>>, JcrConstants.NT_UNSTRUCTURED, session);

//Set the required properties
node.setProperty("name", "sample");
node.setProperty("description", "sample");

//Save the session
session.save();

While creating the NT_UNSTRUCTURED node make sure the parent folder is sling:folder, the node will not be created if the parent node is of type nt::folder.



Friday, July 25, 2014

Handling Parallel events through OnEvent event handlers – Oracle SOA Suite

Handling Parallel events through OnEvent event handlers – Oracle SOA Suite

This post will explain, how to handle Parallel events through OnEvent event handlers in Oracle SOA Suite 11g



Download Handling_Parallel_events_ OnEvent_event_handlers_V1.pdf


Thursday, July 24, 2014

Cipher not initialized exception while invoking the Salesforce service through OSB

Cipher not initialized exception while invoking the Salesforce service through OSB

We are getting the "Cipher not initialized" exception wile invoking the Salesforce services through OSB.


We are able to invoke the login.salesforce.com URL successfully and able to receive the session id, also this exception was thrown only for a particular sandbox but the all other sandbox invocation is successful.

The "Cipher not initialized" exception will be thrown when there is no common Ciphers available between the client and server while negotiating the SSL communication.

We have raised a case with Salesforce regarding this and receive the response as "We recently upgraded our Cipher suites for SSL. To resolve the issue upgrade latest version of Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files- 6 for JDK1.6 on middleware."

After upgrading the Unlimited Strength Jurisdiction Policy Files in all the servers nodes we are able to invoke the service successfully.

Steps to resolve the issue

  • Download the Unlimited Strength Jurisdiction Policy Files from http://www.oracle.com/technetwork/java/javase/downloads/index.html(Under Additional Resources" section), for java 1.6 use http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html
  • Unzip the downloaded zip 
  • Copy local_policy.jar and US_export_policy.jar to the $JAVA_HOME/jre/lib/security in all the OSB nodes.
  • Restarts the servers.
Now you will be able to invoke the service successfully.


Thursday, July 10, 2014

Integrating Adobe Experience Manager(AEM) with REST services

Integrating Adobe Experience Manager(AEM) with REST services

The below document explains the approach to integrate Adobe CQ5 with REST services.



Download Integrating_CQ5_with_RESTServices.pdf


Saturday, July 5, 2014

java.io.IOException: Server returned HTTP response code: 400 - While invoking the Salesforce login url from java to get the access token

java.io.IOException: Server returned HTTP response code: 400 - While invoking the Salesforce login url from java to get the access token

I was getting the below exception while invoking the Salesforce login url to get the OAuth access_token from java.

java.io.IOException: Server returned HTTP response code: 400 for URL: https://login.salesforce.com/services/oauth2/token
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at RestCaller.execute(RestCaller.java:46)
at RestCaller.main(RestCaller.java:10)

This exception will happen normally when the values of client_id, client_security, username and password are not specified correctly while invoking the login url - https://login.salesforce.com/services/oauth2/token to get the OAuth access token.

"grant_type=password&client_id=13MVG9Y6d_xxxxxxx&client_secret=8039xxxxx&username=albinsharpxxxxx&password=Albinxxxx"

In my case, I have specified all the values properly but still it was not working, it worked after resetting the password and getting the new security token - password(password+security token)