Saturday, 21 January 2017

IBM WebSphere Liberty Profile - To Java or not to Java

One of my friends asked me about the implications of installing or not installing Java when one installs WebSphere Liberty Profile (WLP)

This is what I told him ...

It depends upon what you actually download and install. For example, I downloaded this: -

IBM WebSphere Application Server Liberty Core V8.5.5 for Multiplatform Multilingual (installed using IBM Installation Manager)  CIK2VML

from, as per this: -

How to download WebSphere Application Server Liberty Core V8.5.5 from Passport Advantage Online

and installed it using a response file -  installWLP.rsp : -

<?xml version='1.0' encoding='UTF-8'?>
<agent-input>
  <server>
    <repository location='/mnt/hgfs/DownloadDirector/WLP' temporary='true'/>
  </server>
  <profile id='WebSphere Liberty V8.5' installLocation='/opt/ibm/WebSphere/Liberty'>
    <data key='cic.selector.arch' value='x86_64'/>
  </profile>
  <install>
    <!-- IBM WebSphere Application Server Liberty Core 8.5.5.0 -->
    <offering profile='WebSphere Liberty V8.5' id='com.ibm.websphere.liberty.v85' version='8.5.5000.20130514_1313' features='liberty,embeddablecontainer'/>
  </install>
  <preference name='com.ibm.cic.common.core.preferences.eclipseCache' value='/opt/ibm/IMShared'/>
</agent-input>


This provides me with the WLP runtime, but NO JDK/JRE. This means that, when I start a server: -

/opt/ibm/WebSphere/Liberty/bin/server start

Starting server defaultServer.
Server defaultServer started with process ID 23307.


cat /opt/ibm/WebSphere/Liberty/usr/servers/defaultServer/logs/console.log 

Server defaultServer created.
Launching defaultServer (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130510-0831) on OpenJDK 64-Bit Server VM, version 1.7.0_121-mockbuild_2016_11_01_00_38-b00 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[AUDIT   ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.

cat /opt/ibm/WebSphere/Liberty/usr/servers/defaultServer/logs/messages.log 

********************************************************************************
product = WebSphere Application Server 8.5.5.0 (wlp-1.0.3.20130510-0831)
wlp.install.dir = /opt/ibm/WebSphere/Liberty/
java.home = /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.121.x86_64/jre
java.version = 1.7.0_121
java.runtime = OpenJDK Runtime Environment (1.7.0_121-mockbuild_2016_11_01_00_38-b00)
os = Linux (2.6.32-642.13.1.el6.x86_64; amd64) (en_US)
********************************************************************************
[1/19/17 19:47:15:189 GMT] 00000001 com.ibm.ws.logging.internal.TraceSpecification               I TRAS0018I: The trace state has been changed. The new trace state is *=info.
[1/19/17 19:47:15:203 GMT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           A CWWKE0001I: The server defaultServer has been launched.
[1/19/17 19:47:16:372 GMT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           I CWWKE0002I: The kernel started after 1.419 seconds
[1/19/17 19:47:16:432 GMT] 00000015 com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0007I: Feature update started.
[1/19/17 19:47:17:445 GMT] 00000019 com.ibm.ws.tcpchannel.internal.TCPChannel                    I CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host localhost  (IPv4: 127.0.0.1) port 9080.
[1/19/17 19:47:17:561 GMT] 0000000d com.ibm.ws.app.manager.internal.monitor.DropinMonitor        A CWWKZ0058I: Monitoring dropins for applications. 
[1/19/17 19:47:17:603 GMT] 00000015 com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0008I: Feature update completed in 1.229 seconds.
[1/19/17 19:47:17:603 GMT] 00000015 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server defaultServer is ready to run a smarter planet.


To run WLP, I'm using whatever JRE available to me.

I can see this as follows: -

which java

/usr/bin/java

`which java` -version

java version "1.7.0_121"
OpenJDK Runtime Environment (rhel-2.6.8.1.el6_8-x86_64 u121-b00)
OpenJDK 64-Bit Server VM (build 24.121-b00, mixed mode)


This is the JDK that comes with my Linux ( Red Hat Enterprise Linux 6.8 )

If I remove the JDKs from my box: -

rpm -e java-1.7.0-openjdk-1.7.0.121-2.6.8.1.el6_8.x86_64
rpm -e java-1.6.0-openjdk-1.6.0.40-1.13.12.6.el6_8.x86_64


I can't start WLP: -

/opt/ibm/WebSphere/Liberty/bin/server start

/opt/ibm/WebSphere/Liberty/bin/server: line 708: java: command not found

Therefore, I either need to rely upon the OS to provide a JDK ( which is, perhaps, an unsafe dependency ) or install an IBM JDK, such as: -

IBM WebSphere SDK Java Technology Edition V7.0 (1 of 2) (for WebSphere Application Server Liberty Core V8.5.5) Multiplatform Multilingual
IBM WebSphere SDK Java Technology Edition V7.0 (2 of 2) (for WebSphere Application Server Liberty Core V8.5.5) Multiplatform Multilingual

Whilst I download the latter, I installed the OpenJDK 1.8 onto my box: -

which java

/usr/bin/java

`which java` -version

openjdk version "1.8.0_111"
OpenJDK Runtime Environment (build 1.8.0_111-b15)
OpenJDK 64-Bit Server VM (build 25.111-b15, mixed mode)


Interestingly, Liberty doesn't want to start; most likely because it's not tested/supported with Java 8: -

/opt/ibm/WebSphere/Liberty/bin/server start

OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Starting server defaultServer.


If I put Java 1.7 back on the box, we're golden: -

cat /opt/ibm/WebSphere/Liberty/usr/servers/defaultServer/logs/console.log

Launching defaultServer (WebSphere Application Server 8.5.5.0/wlp-1.0.3.20130510-0831) on OpenJDK 64-Bit Server VM, version 1.7.0_121-mockbuild_2016_11_01_00_38-b00 (en_US)
[AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[AUDIT   ] CWWKZ0058I: Monitoring dropins for applications. 
[AUDIT   ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.


In terms of the JDK / SDK ( Java Software Development Kit ) vs. the JRE ( Java Runtime Environment ), broadly speaking, a SDK or JDK provides one with the ability to compile Java classes e.g.: -

/opt/ibm/WebSphere/AppServer/java/bin/javac HelloWorld.java

whereas a JRE provides one with the ability to execute a compiled Java class e.g. : -

/opt/ibm/WebSphere/AppServer/java/bin/java HelloWorld

which returns: -

Hello World! 

Bottom line, WLP *does* require Java; unlike WAS ND, it's not installed by default, but WLP will use a SDK/JRE if available, or you can mandate and thus install an IBM SDK of your choosing ( Java 6 or Java 7 for WLP 8.5 and Java 8 for WLP 9 - or the equivalent 16.XXX codebase ).

An OS such as Linux can have multiple SDKs or JREs installed; as per my example, I had Java 1.6 ( aka Java 6 ) and Java 1.7 ( aka Java 7 ) installed, plus various others ( I previously had WAS ND, ODM 8.7 and ODM 8.8 installed, all of which included JREs ).

So there's no issue in having multiple JREs in different paths; it's just a matter of specifying the path ….

As an update, having downloaded Java 7, as per my previous: -

-rw-r--r--@  1 davidhay  staff  1031566304 19 Jan 21:12 SDK_JAVA_TE_V7.0_1OF2_WASLC_V8.5.5.zip
-rw-r--r--@  1 davidhay  staff   734081206 19 Jan 20:36 SDK_JAVA_TE_V7.0_2OF2_WASLC_V8.5.5.zip


I've installed it using IIM and a response file - installJava7.rsp 

<?xml version='1.0' encoding='UTF-8'?>
<agent-input>
  <server>
    <repository location='/mnt/hgfs/DownloadDirector/Java' temporary='true'/>
  </server>
  <profile id='WebSphere Liberty V8.5' installLocation='/opt/ibm/WebSphere/Liberty'>
    <data key='cic.selector.arch' value='x86_64'/>
  </profile>
  <install>
    <!-- IBM WebSphere SDK Java Technology Edition Version 7.0 for Liberty 7.0.4.1 -->
    <offering profile='WebSphere Liberty V8.5' id='com.ibm.websphere.liberty.IBMJAVA.v70' version='7.0.4001.20130510_2103' features='com.ibm.sdk.7'/>
  </install>
  <preference name='com.ibm.cic.common.core.preferences.eclipseCache' value='/opt/ibm/IMShared'/>
</agent-input>


Having installed this, WLP now uses the IBM SDK rather than the system default: -

cat /opt/ibm/WebSphere/Liberty/usr/servers/defaultServer/logs/messages.log
 
********************************************************************************
product = WebSphere Application Server 8.5.5.0 (wlp-1.0.3.20130510-0831)
wlp.install.dir = /opt/ibm/WebSphere/Liberty/
java.home = /opt/ibm/WebSphere/Liberty/java/java_1.7_64/jre
java.version = 1.7.0
java.runtime = Java(TM) SE Runtime Environment (pxa6470sr4fp1ifx-20130423_02 (SR4 FP1+IV38579+IV38399+IV40208))
os = Linux (2.6.32-642.13.1.el6.x86_64; amd64) (en_US)
********************************************************************************
[1/19/17 21:14:54:717 GMT] 00000001 com.ibm.ws.logging.internal.TraceSpecification               I TRAS0018I: The trace state has been changed. The new trace state is *=info.
[1/19/17 21:14:54:749 GMT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           A CWWKE0001I: The server defaultServer has been launched.
[1/19/17 21:14:56:613 GMT] 00000001 com.ibm.ws.kernel.launch.internal.FrameworkManager           I CWWKE0002I: The kernel started after 2.432 seconds
[1/19/17 21:14:56:670 GMT] 0000001d com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0007I: Feature update started.
[1/19/17 21:14:57:742 GMT] 00000021 com.ibm.ws.tcpchannel.internal.TCPChannel                    I CWWKO0219I: TCP Channel defaultHttpEndpoint has been started and is now listening for requests on host localhost  (IPv4: 127.0.0.1) port 9080.
[1/19/17 21:14:58:110 GMT] 00000016 com.ibm.ws.app.manager.internal.monitor.DropinMonitor        A CWWKZ0058I: Monitoring dropins for applications. 
[1/19/17 21:14:58:171 GMT] 0000001d com.ibm.ws.kernel.feature.internal.FeatureManager            I CWWKF0008I: Feature update completed in 1.556 seconds.
[1/19/17 21:14:58:171 GMT] 0000001d com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The server defaultServer is ready to run a smarter planet.

This is what I have installed: -

/opt/ibm/InstallationManager/eclipse/tools/imcl listInstalledPackages -features -long

/opt/ibm/InstallationManager/eclipse : com.ibm.cic.agent_1.8.5001.20161016_1705 : IBM®Installation Manager : 1.8.5.1 : 
/opt/ibm/WebSphere/Liberty : com.ibm.websphere.liberty.IBMJAVA.v70_7.0.4001.20130510_2103 : IBM WebSphere SDK Java Technology Edition Version 7.0 for Liberty : 7.0.4.1 : 
/opt/ibm/WebSphere/Liberty : com.ibm.websphere.liberty.v85_8.5.5000.20130514_1313 : IBM WebSphere Application Server Liberty Core : 8.5.5.0 : embeddablecontainer

Note that I needed to install WLP before Java 7, or I get this: -

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installJava7.rsp -acceptLicense

ERROR: The following errors were generated while installing.
  CRIMA1071E ERROR: The installation package 'IBM WebSphere SDK Java Technology Edition Version 7.0 for Liberty' requires components supplied by other packages.
  The required components might be supplied by the following installation packages:
  Package: IBM WebSphere Application Server Liberty 
  Package: IBM WebSphere Application Server Liberty Trial 
  Package: IBM WebSphere Application Server Liberty - Express 
  Package: IBM WebSphere Application Server Liberty - Express Trial 
  Package: IBM WebSphere Application Server Liberty Network Deployment 
  Package: IBM WebSphere Application Server Liberty Network Deployment Trial 
  Package: IBM WebSphere Application Server Liberty Core 
  Package: IBM WebSphere Application Server Liberty for z/OS 
    ERROR: The following additional components are required in installation location 'WebSphere Liberty V8.5':
      ERROR: In root installation context:
        ERROR: Installation context "com.ibm.websphere.liberty.java.installcontext" was not resolved
    ERROR: The following additional components are required in installation location 'WebSphere Liberty V8.5':
      ERROR: In root installation context:
        ERROR: Installation context "com.ibm.websphere.liberty.java.installcontext" was not resolved
    ERROR: In root installation context:
      ERROR: Installation context "com.ibm.websphere.liberty.java.installcontext" was not resolved

If I do it the right way around: -

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installWLP.rsp -acceptLicense

Installed com.ibm.websphere.liberty.v85_8.5.5000.20130514_1313 to the /opt/ibm/WebSphere/Liberty directory.

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installJava7.rsp -acceptLicense

Installed com.ibm.websphere.liberty.IBMJAVA.v70_7.0.4001.20130510_2103 to the /opt/ibm/WebSphere/Liberty directory.

we're golden.

If I do both in one response file - installEverything.rsp

<?xml version='1.0' encoding='UTF-8'?>
<agent-input>
  <server>
    <repository location='/mnt/hgfs/DownloadDirector/WLP' temporary='true'/>
    <repository location='/mnt/hgfs/DownloadDirector/Java' temporary='true'/>
  </server>
  <profile id='WebSphere Liberty V8.5' installLocation='/opt/ibm/WebSphere/Liberty'>
    <data key='cic.selector.arch' value='x86_64'/>
  </profile>
  <install>
    <!-- IBM WebSphere Application Server Liberty Core 8.5.5.0 -->
    <offering profile='WebSphere Liberty V8.5' id='com.ibm.websphere.liberty.v85' version='8.5.5000.20130514_1313' features='liberty,embeddablecontainer'/>
    <offering profile='WebSphere Liberty V8.5' id='com.ibm.websphere.liberty.IBMJAVA.v70' version='7.0.4001.20130510_2103' features='com.ibm.sdk.7'/>
  </install>
  <preference name='com.ibm.cic.common.core.preferences.eclipseCache' value='/opt/ibm/IMShared'/>
</agent-input>

/opt/ibm/InstallationManager/eclipse/tools/imcl -input installEverything.rsp -acceptLicense

Installed com.ibm.websphere.liberty.v85_8.5.5000.20130514_1313 to the /opt/ibm/WebSphere/Liberty directory.
Installed com.ibm.websphere.liberty.IBMJAVA.v70_7.0.4001.20130510_2103 to the /opt/ibm/WebSphere/Liberty directory.


again, we're good to go.

No comments:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...