Oracle Enterprise Manager EMCLI on Mac OS X

EMCLI is not certified or supported on Mac OS X, but I wondered if it is possible to run on my new macbook. I searched metalink, googled and couldn’t found any useful information. I thought it should be easy because EMCLI is a java application certified to run almost all enterprise operating systems including HP-UX, AIX, Linux, Windows, Solaris, and we all remember “write once, run everywhere” slogan of Java. Unfortunately it wasn’t as easy as I expected 🙂

I have downloaded emclikit.jar from my Enterprise Manager web console, and tried to install it. Here’s the output:

UnsupportedOperationException? What kind of unsupported operation could it be? For a Java application which its primary duty is to communicate with a web service, this error was surprising for me.

As you can see from the error stack, the exception was thrown in getFiles method. So I though there could be something about permissions of the files, or maybe something about how java access to folders. After some hours of debugging, I found that this exception was thrown intentionally when the emcli installer detects an unsupported operating system. So we hit an artificial barrier which is put there by the developer.

Is it possible to tell emcli installer that we use a supported OS (ie Linux)? Not always, but most Java developers uses system property called “os.name” to detect the operating system, and our emcli developer also uses this method. We can add “-Dos.name=Linux” parameter to fake the installer:

I like these kind of challenges 😉 It didn’t work because the jar file, calls another jaf file so our parameter doesn’t affect to the method. We need to change os.name permanently for our terminal session. The JAVA_TOOL_OPTIONS environment variable helps us to do it:

Hurray! We beat the detection. Have you noticed that two “Picked up JAVA_TOOLS_OPTIONS”? This is why the parameter “-Dos.name=Linux” didn’t work. Anyway, because we have successfully installed the emcli, let’s run it:

I use Java 1.8.x, so why does it say that it requires version 1.6 or greater? After examining the emcli script, I see that the developer finds the java version by running “java -version” and parsing the output. Unfortunately our output has an extra line:

The JAVA_TOOL_OPTIONS variable already served us well. We have installed the emcli, so I unset that variable, and include “-Dos.name=Linux” into emcli script itself. Search for exec “$JAVA_PROGRAM” line in the file. You’ll find two. One for windows, one for Unix. You can easily understand it by reading the comment lines. Then add “-Dos.name=Linux” after -DoracleHome=”$OracleHome”:

After this change, I have successfully issued the following commands:

Everything looks OK! I haven’t tested all EMCLI verbs but for now it seems it works successfully. I also installed emcliadvancedkit (the one supporting Jpython scripting) with same method. Let me know if you encounter any problems. Of course, this is an unsupported and non-certified installation and you shouldn’t rely on it, and use it on production systems.

Please share
  • 1
  •  
  •  
  •  
  •  
  •  

AWS Big Data Specialist. Oracle Certified Professional (OCP) for EBS R12, Oracle 10g and 11g. Co-author of "Expert Oracle Enterprise Manager 12c" book published by Apress. Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community. Founding member, and vice president of Turkish Oracle User Group (TROUG). Presented at various international conferences including Oracle Open World.

2 Comments

  1. Roland Evers

    Hi Gokhan,

    Nice article! I wonder if create_plugin and validate_plugin steps would work though, as there are a couple of .sh or .bat scripts being triggered in the background.

    Still nice to see this though!

    Kind regards,

    Roland

  2. Here we are 3 years later, and still no support for emcli on Mac OS. I use MacOS for all my testing needs (with brew). I don’t plan on running this for production scripting, but I shouldn’t need a Linux or Windows box to test out some scripting. Very insightful and is getting me up and running with the 13.2 emcli

Leave Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.