Showing posts with label osx. Show all posts
Showing posts with label osx. Show all posts

July 13, 2015

WSO2 ESB with SAP in OSX

Configure WSO2 ESB for SAP

Refer below steps while following the official documentation [1] to do the configurations in OSX.

1. Download SAP JCO for OSX from

2. Copy the sapjco3.jar and sapidoc3.jar files to [ESB_HOME]/repository/components/lib folder

3. Setup classpath to SAP as follows : 
export LD_LIBRARY_PATH=/Users/maheeka/sapjco3/
export CLASSPATH=/Users/maheeka/sapjco3/sapjco3.jar
For additional details on configuring classpath refer [2]

4. Enable SAP transport receiver/sender and create *.dest and *.server files as mentioned in documentation [1] (will be referred to as SAP.dest and SAP.server below)

5. Start ESB with the following command
sh [ESB_HOME]bin/ -Djava.library.path=<path_sapjco3>
Give path to sapjco3 folder downloaded in step 1.


Configure SAP with SAPGUI

SAPGUI is the client used for configuring SAP.

1. Download SAP GUI for OSX : PlatinGUI740_0-20012037.JAR and  (documentation) files from :
(SAP GUI 7.3.0 requires jdk 7 and SAP GUI 7.4.0 requires jdk 8 minimum)

2. Issue command : java -jar PlatinGUI740_0-20012037.JAR install
(Download PlatinManual_0-20008876.ZIP from the above location for the manual containing installation instructions)

3. Go through the installation wizard to install SAP GUI

4. Configure the following in SAP to connect to ESB via SAP GUI. First configure a connection and do the following steps.

  1. Create a TCP/IP connection and test the connection (RFC Destinations > TCP/IP Connections)
  2. Create a port (Port definition)
  3. Create a logical system (Maintaining Logical Systems)
  4. Create a partner agreement for the logical system (Partner Profiles)
  5. Create outbound and inbound parameters for partner agreement
You can also use transaction codes instead of using the user menu for this step. Transaction codes are available at :

Sample IDoc Sender

Use the following proxy as a sample IDOC sender.

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns=""
         <xslt key="idoc.xslt"/>
         <property name="FORCE_SC_ACCEPT" value="true"/>
         <property name="OUT_ONLY" value="true"/>
               <address uri="idoc:/SAP"/>

"idoc.xslt" will create a IDOC payload and the proxy will send the request to SAP.

Invoke the proxy with : curl -v -X POST "http://localhost:8280/services/IDOCProxy"
If the invoke is successful, you can view the response in IDOC List menu.


1. Enable tracing for SAP by setting the trace property in *.dest file as : jco.client.trace=1
2. When step (3) and (5) in "Configure SAP with WSO2 ESB" is not done correctly : 
FATAL - CarbonServerManager WSO2 Carbon initialization Failed
java.lang.ExceptionInInitializerError: JCo initialization failed with java.lang.UnsatisfiedLinkError: no sapjco3 in java.library.path
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance(
   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
   at java.lang.reflect.Constructor.newInstance(
   at java.lang.Class.newInstance0(
   at java.lang.Class.newInstance(
   at org.apache.axis2.deployment.AxisConfigBuilder.processTransportSenders(
   at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(
   at org.wso2.carbon.core.CarbonAxisConfigurator.populateAxisConfiguration(
   at org.wso2.carbon.core.CarbonAxisConfigurator.getAxisConfiguration(
   at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(
   at org.wso2.carbon.core.CarbonConfigurationContextFactory.createNewConfigurationContext(
   at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(
   at org.wso2.carbon.core.init.CarbonServerManager.start(
   at org.wso2.carbon.core.internal.CarbonCoreServiceComponent.activate(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(
   at org.eclipse.equinox.internal.ds.model.ServiceComponent.activate(
   at org.eclipse.equinox.internal.ds.model.ServiceComponentProp.activate(
   at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponent(
   at org.eclipse.equinox.internal.ds.InstanceProcess.buildComponents(
   at org.eclipse.equinox.internal.ds.Resolver.getEligible(
   at org.eclipse.equinox.internal.ds.SCRManager.serviceChanged(
   at org.eclipse.osgi.internal.serviceregistry.FilteredServiceListener.serviceChanged(
   at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(
   at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(
   at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(
   at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEventPrivileged(
   at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(
   at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(
   at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(
   at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(
   at org.eclipse.equinox.http.servlet.internal.Activator.registerHttpService(
   at org.eclipse.equinox.http.servlet.internal.Activator.addProxyServlet(
   at org.eclipse.equinox.http.servlet.internal.ProxyServlet.init(
   at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.init(
   at org.apache.catalina.core.StandardWrapper.initServlet(
   at org.apache.catalina.core.StandardWrapper.loadServlet(
   at org.apache.catalina.core.StandardWrapper.load(
   at org.apache.catalina.core.StandardContext.loadOnStartup(
   at org.apache.catalina.core.StandardContext.startInternal(
   at org.apache.catalina.util.LifecycleBase.start(

February 13, 2015

Apple Script to copy a file repeatedly

Open Apple Script Editor and add the following script and hit run button.

set theFile to "Macintosh HD:Users:maheeka:original_file:test.xml"
set theDestinationFolder to "Macintosh HD:Users:maheeka:test_des"

repeat 10 times
tell application "Finder"
duplicate theFile to theDestinationFolder with replacing
end tell
delay 2
end repeat

Note :
  • Always use an alias for the file location
  • File path should be separated with : and not /

January 28, 2015

Remove 3rd Party Apps in OSX

Removing apps installed on OSX via App Store is very easy. You just have to go to LaunchPad tap and hold on the icon of the app you want to uninstall until a small cross appears on the top right corner. Click on this cross and you can uninstall the app.

However, for 3rd party apps where you either downloaded a .dmg and installed or however, it is not that straightforward. So in order to do that you can do the following. 

Example : 

Maheekas-MacBook-Pro:~ maheeka$ mdfind -name mackeeper
/Users/maheeka/Library/Application Support/MacKeeper Helper

This lists down all folders and files in the system with name as "mackeeper". Delete each of these folders and files. 

Local FTP Server on OSX

To start a local FTP server : 
$ sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist

To stop local FTP server : 
$ sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist

To connect to FTP server : 
Maheekas-MacBook-Pro:~ maheeka$ ftp localhost
Trying ::1...
Connected to localhost.
220 ::1 FTP server (tnftpd 20100324+GSSAPI) ready.
Name (localhost:maheeka): maheeka
331 User maheeka accepted, provide password.
230 User maheeka logged in.
Remote system type is UNIX.
Using binary mode to transfer files.


Once connected, most of normal file system related commands will work similarly.

ftp> pwd
Remote directory: /Users/maheeka
ftp> mkdir test
257 "test" directory created.
ftp> cd test
250 CWD command successful.
ftp> mkdir newfolder
257 "newfolder" directory created.
ftp> ls
229 Entering Extended Passive Mode (|||50051|)
150 Opening ASCII mode data connection for '/bin/ls'.
total 0
drwxr-xr-x  2 maheeka  staff  68 Feb  1 10:02 newfolder
226 Transfer complete.
ftp> pwd

Remote directory: /Users/maheeka/test

For a complete reference of ftp commands refer :

To access FTP Server from browser :

Type ftp://username:password@localhost/ on address bar.

Reference : 

November 10, 2014

Building WSO2 ESB 4.8.1 from source in OSX

WSO2 products are all built on top of WSO2 Carbon Kernel. This is the common ground for all products. Turing is the platform release name for WSO2 Carbon 4.2.0 and WSO2 ESB 4.8.1 is based on turing. Not all products of the WSO2 platform does not get released at the same time. Therefore, these products are released in chunks. ESB 4.8.1 comes under chunk 7 of the turing platform. Refer the release matrix to get more info on this [2].
Prerequisites : 
1. Install Java 1.6 and Maven 3
       If you have only 1.7 installed, you will have to install 1.6 on OSX. Unfortunately, there is no direct installation for 1.6. But this sorted out for me  since jdk 1.6 was automatically installed when I installed IntellijIdea
       At the moment, all WSO2 products are compiled on Java 1.6 and is supported up to 1.7. This is why we need to build the source on 1.6.
2. Checkout Source (Orbit, Kernel, Platform)

Building the Source : 

Start building in order Orbit > Kernel > Platform (chunk 07) repos respectively.

To build ESB 4.8.1, you need to build wso2carbon-platform/product-releases/chunk-07 as Platform in above.

The distribution will be created in :


When building, since it will take a lot of time, and to avoid unit test failures from building the product, skip unit tests when building.

mvn clean install -Dmaven.test.skip=true

Build ESB only :

If you need to build only ESB, build at wso2carbon-platform/products/esb with mvn clean install -Dmaven.test.skip=true

Another option is to comment out other product modules in platform/trunk/pom.xml and rebuilding in Orbit > Kernel > Platform in order.

Encountered Errors : 
  1. WSS4 maven install fails > You need to compile in Java 1.6
  2. [WARNING] Error injecting: org.apache.maven.reporting.exec.DefaultMavenReportExecutor > Set maven-site plugin version to 3.3 in all places [4]
Environment : 

October 26, 2014

Grep - Find a text in file (Unix/Linux)

To find the text files containing a particular string :

grep -l "maheeka" *.txt

Search in current directory :
grep -lr "maheeka" . 

To view the occurrences of the string in the files, use without "-l" option