This blog contains experience gained over the years of implementing (and de-implementing) large scale IT applications/software.

SAP JVM and the Oracle Java SE 8 Licensing Confusion

What is the issue for users of Oracle Java SE 8 ?
In January 2018, Oracle released a statement that it was extending the end-of-life for Oracle Java SE 8 updates to “at least” January 2019.
With no official update for another extension, we have to assume that we are reaching that cut-off point.
See the Oracle statement in full here: https://blogs.oracle.com/java-platform-group/extension-of-oracle-java-se-8-public-updates-and-java-web-start-support

What does this statement mean for Oracle Java SE 8 end-consumers?
For consumers of Java programs who wish to execute those programs using the Oracle SE JVM 8, there is no issue.
You can continue to do so, still for free, at your own risk.  Oracle always recommends you maintain a recent version of the JVM for executing Java programs.

What does this statement mean for corporate consumers?
For corporate consumers, the same applies as to public consumers.
If you are simply executing Java programs, you can continue to do so, for free, at your own risk.
However, if you use the Oracle Java SE 8 to compile Java bytecode (you use the javac program), *and* you wish to receive maintenance updates from Oracle, you will need to pay for a license from Oracle (a subscription if you like).
If you don’t want to pay, then you will not be eligible to receive Oracle Java SE 8 updates past January 2019.
Are there any other options, yes, if you are an SAP customer, you have the option to use the SAP JVM.

If you are not an SAP customer, there are alternative distributions of Java available from third-party projects such as OpenJDK.
More information can be seen here: https://www.azul.com/eliminating-java-update-confusion

What does all of this mean for consumers of the SAP JVM?
In short, there is no real license implication, since the SAP JVM is an entirely separate implementation of Java since 2011 when SAP created it’s own SAP JVM 4.  See SAP notes 1495160 & 1920326 for more details.
You will notice that in the SAP notes for SAP JVM, SAP indicate the base Oracle Java patches which have been integrated into the SAP JVM version (see SAP note 2463197 for an example).

The current SAP JVM 8.1 still receives updates, as usual, however, SAP also recommend that you look to move to the latest *supported* version of the SAP JVM for your SAP products.
For those who didn’t know, you should be patching the SAP JVM along with your usual SAP patching and maintenance activities.
See here for a Netweaver stack compatibility overview: https://wiki.scn.sap.com/wiki/display/ASJAVA/SAP+JVM+Netweaver+compatibility+and+Installation

SAP are constantly applying SAP JVM fixes and enhancements.  A lot of time these are minor “low” priority issues and timezone changes.
To see what fixes are available for your SAP JVM version, you can search for “SAP JVM” in the SAP Software Download Centre, or alternatively look for SAP notes for component BC-JVM with the title contents containing the words “SAP JVM patch collection”.  Example: “2463197 – SAP JVM 8.1 Patch Collection 30 (build 8.1.030).”

There are different methods to apply a SAP JVM update depending on the SAP product you have.  Some are simply deployed with SAPCAR, some with SUM and some with “unzip”.  Check for SAP notes for your respective SAP product.

As with any software there are sometimes security issues for the SAP JVM.
SAP will issue security notes and include the CVSS score (see 1561103 as an example).  These notes should be viewed as critically as you view all SAP security notes and included as part of your “super Tuesday” patching sessions.

What is: SAP AS Java Flight Recorder

In Solution Manager 7.1 “Managed System Configuration” step 7, you are requested to manually apply an instance profile parameter (jstartup/recorder) that configures the “Flight Recorder”:



The help for the item shows the following:

3ea55e82-f4d0-4eac-b0f2-6cb9d5fe1273

But the help doesn’t tell you what the Flight Recorder does and when you might use it.
So it was time to do a little research.

What does the flight recorder do?

Simply put, the flight recorder starts up only when a SAP Java server process (JVM) crashes (e.g. server0 crashes).
The flight recorder’s job is to gather up any available logs and traces and zip them up, before the system restarts the process.

Where are the dump zip files?

The zip files are stored by default in DIR_GLOBAL/dumps (e.g. /sapmnt/<SID>/global/dumps).
Typically the zip file is about 1-2MB in size and can contain around 1250 files.

What is included in a dump zip?

If you unzip a dump zip file, you will notice you get 3 different types of files extracted.
1– File system properties and config files, that were present on the file system at the time of the dump.
2– Database properties and config, that were stored in the database at the time of the dump.
3– Log files and traces, that were stored on the file system at the time of the dump.

Apart from looking in the DIR_GLOBAL/dumps area, trace or logs files, how can I see these dump zip files?

When you log into the System Info page of the Java server, you will see on the right hand side “Info for crashes of this node”:

https://<server>:5##00/monitoring/SystemInfo

ec8778de-6288-49ab-a7fe-cfd1bd271e69

How can we trigger a dump to see if this is all true?

Simple, we can just kill the server0 process like this:

DO NOT DO THIS IN PRODUCTION.

sidadm> ps -ef | grep server0

sidadm> kill 12345         <–  This is the PID output from the previous command.

You will not really see the flight recorder process active, it’s very quick.
You will see the dump generated in the dumps folder.

Hopefully now, you can make use of the flight recorder.

Convert SAP AS Java Trace Timestamp

Sometimes, just sometimes, you wish you could just take a look at the defaulttrace.log or one of the other many log files at the O/S level for an SAP AS Java based system.
Except, it’s not that simple.  Whilst the file is text based, you’re not able to read the date/time stamp that exists on each line.
Well, here’s a simple couple of methods to do this conversion, which is basically converting from the epoch.
The first method is using a pure Korn Shell (KSH) method, useful for converting maybe one or two values:

dt=1435140894139
echo $(date -d “1970-01-01 ${dt:0:10} seconds”)

This second method uses AWK which makes it much better at converting all values by simpling piping in the original file to see the output:

NOTE: Below I’m searching for entries related to “com.sap.engine.services.httpserver.server.log”.
NOTE 2: The below command is all on one line.

cat responses.0.trc | awk -F# ‘/com.sap.engine.services.httpserver.server.Log/  { print strftime(“%F %T”,substr($4,1,10))”#”$24 }’

Starting and Stopping Individual SAP AS Java Server Processes

Should you need to restart either manually or automatically (via script) a specific AS Java server node, it’s possible to use the sapcontrol tool to provide precise control.

The method detailed below is based on the documentation provided here:
Performs a given control function (EnableProcess/StartProcess, DisableProcess/StopProcess,
SoftStopProcess, ActivateProcess, DeactivateProcess, RestartProcess, SoftRestartProcess,
DumpStackTrace, EnableDebugging, DisableDebugging, IncrementTrace, DecrementTrace) on a given AS
Java process. processname must match a process name in the AS Java process list returned by
J2EEGetProcessList. To perform AS Java instance-wide operations (StartInstance, StopInstance,
RestartInstance, BootInstance, RebootInstance), use processname “all”.
Based on the above information, we can query the AS Java processes for a specific AS Java instance, using the following command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
The command will return a list of the processes that the instance is running.
For a 2 node AS Java system, you can see the Server0 and Server1 processes in the list.
To restart Server0 on the AS Java instance use the below command line as the sidadm user:

sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEControlProcess “server0” “RestartProcess”
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.
Change “server0” for “server1” if you want to restart server1.
Based on the above restart, you can monitor the restart by using the below command line to see when the restart is completed:
sidadm> sapcontrol -host [host] -nr [sys##] -function J2EEGetProcessList | awk -F, ‘{ if ( $2 != “” && FNR > 5 ){ print “Name: “$2″ttState: “$8″ttStarted: “$9 }}’
You should substitute the “host” and “sys##” with the host of your application server (virtual host) and the SAP instance number.