To demonstrate the usage of the MXBean, we have created a docker image of a Helloworld servlet with open liberty server and the AdoptOpenJDK openjdk8-openj9 nightly docker build and pushed it to hub.docker.com, you can find it here.
-
git clone https://github.com/ibmruntimes/OpenJ9DianosticsMXBeanDemo.git
-
Login to the ICP server and click on the logged in user and go to configure client option
-
Copy the kubectl commands from the configure client option and execute these commands on the linux machine
-
Configure a NFS persistent volume and update the NFS Server IP Addr and path in the below section in "hello-deploy-dockerhub.yaml" nfs: server: path:
-
Execute kubectl-create.sh to deploy the application from the docker hub link specified above and to create a service
-
Login to ICP and check if the application is deployed and service is running or use the below command:
kubectl get pods -
Check the application logs from the linux machine by issuing the below command:
kubectl logs -f -c <container> <pod name>For example,
kubectl logs -f -c hello-mxbean-vol hello-mxbean-vol-ddcbb8688-2fj2n
Note - To connect to the liberty application using JMX, we need to enable the restConnector feature that in turn uses ssl. The restConnector and ssl feature have been enabled in the server.xml. You can refer to configuring secure JMX connection to liberty for details.
We have created a self-signed certificate and ssl keys (keystore.jks) using keytool for testing purpose.
If you would like to re-create the docker image and push it to your docker hub registry, follow the below steps:
-
Execute the below command to re-create the liberty image with adopt openjdk8-openj9 nightly build
./liberty.sh -
Push the docker image created to your hub docker registry and update the below image location in "hello-deploy-dockerhub.yaml" to point to your hub docker registry
image: "index.docker.io/chandra25ms/helloworld-openjdk8-openj9-mxbean"