Top 29 Java Management Extensions (JME) Interview Questions You Must Prepare 04.Dec.2022

A managed bean - sometimes simply referred to as an MBean - is a type of JavaBean, created with dependency injection. Managed Be are particularly used in the Java Management Extensions technology. But, with the Java EE 6 specification provides for a more detailed meaning of a managed bean.

JMX is native to the Java programming language. As a result, it offers natural, efficient, and lightweight management extensions to Java-based functions. It consists of a set of specifications and development tools for managing Java environments and developing state-of-the-art management solutions for applications and services.

Scopes the bean within the bean that uses it. One less bean id in the set of bean names.

There are nested elements within each bean definition.

A pattern (design) whereby collaborators are passed into an object from the outside - the object does not allocate them for itself.

The code that implements the cross cutting-concern that will be inserted at each join-point.

Two examples:

  1. Nested or inner be
  2. Configuration be

Different collaborators for different environments can be injected - test, production, test-database, real database. This allows classes to be tested independent of its collaborators (makes it easy to pass in stub or mock objects).

You have to expose the JMX port to the host and even used Sun specific options while running the Java process.

You are able to telnet to the host ip and the exposed JMX port, which tells that it is accessible. But I can't figure out a way to use JConsole and connect to the JMX service running in the container.

  • Djava.rmi.server.hostname=$JMX_HOSTNAME

WLS8 supports JMX but it uses weblogic implementation of JMX server. It does not supports generalise sun javax API which can be used with any JVM. There are some patches available which can be used with WLS8 which will enabled JMX based monitoring. Once JMX is enable there are many monitoring tools available in the market. One can even go for custom JMX utilities which can be used for server monitoring.

5 scopes defined in Spring:

  1. Singleton
  2. Prototype
  3. Session - only valid in a Web application context
  4. Request - ditto
  5. Custom

Bean is not allocated until it is actually needed - dependency injected - or requested via getBean(). specify lazy="true" (false by default). Only useful if bean genuinely may never be used in most runs of the application.

Types of advice:

  • Before
  • AfterReturning
  • AfterThrowing
  • After
  • Around

A point cut expression that has a name so it can be reused.

Resons To use:

  • Annotation: @Pointcut applied to a dummy method - name of the dummy method is the name of the pointcut expression.
  • XML aop:pointcut id=".." expression=".."

JMX is based on a 3-level architecture:

  1. The Probe level contains the probes (called MBe) instrumenting the resources. Also called the Instrumentation level.
  2. The Agent level, or MBeanServer, is the core of JMX. It is an intermediary between the MBean and the applications.
  3. The Remote Management level enables remote applications to access the MBeanServer through Connectors and Adaptors. A connector provides full remote access to the MBeanServer API using various communication frameworks (RMI, IIOP, JMS, WS), while an adaptor adapts the API to another protocol (SNMP) or to Web-based GUI (HTML/HTTP, WML/HTTP).

JMX is conceptually simple, yet bears the fruit of years of domain experience and research. In a nutshell, JMX defines a standard me for applications to expose management functionality 

  1. Instrumentation level 
  2. Agent level 
  3. Management level

When Tomcat is running as a service on Windows, you do not need setenv.bat, you need to use tomcat8w.exe and GUI toll for adding options.

Here are a few advantages:

  • Constructor
  • Mandatory
  • Mutable
  • Natural Java approach.

Joint-point is an expression that defines zero or more join-points.

Copy {WLHOME}/wlserver_**/server/lib/wlfullclient.jar file into {agent home}/opt/groovy-1.8.8/lib Then the Groovy script (that migrated from my JMX Java application) works.

Here are 5 steps:

  1. Read bean file XML (or process annotations). Build internal "map" of be and determine dependency tree.
  2. Post process the definitions - e.g. resolve ${variables}
  3. Allocate objects - dependency inject constructor args and invoke setter.
  4. Perform any initialisation - 3 approachs: @PostConstruct, init-method, InitializingBean
  5. Bean post-processors - e.g. wrap with proxy, @Required

The application JVM is configured with the following options:


A requirement that cuts across all the natural modules of your application.


  • Tracing, security, tractions, business rules.
  • Two problems with cross-cutting concerns.
  • Code tangling - method doing too many unrelated tasks
  • Code scattering - code duplication leading to maintenance headache

Factory methods that will be used to create objects just like in a static way.

It is created by Spring automatically, any setters are called on the factory then its getObject() method is called to allocate the actual bean.

Here are a few advantages of Setter:

  1. Natural for Java Be
  2. Avoids overly long constructors
  3. Can be inherited
  4. Easier to understand in that properties have names
  5. Constructor args don't have names

No JMX-related output in the logs. I can connect to the JVM with jconsole using the supplied credentials, browse to the configured mbean, jackhammer the Refresh button and get new values. Splunk, however, gets nothing, and leaves no indication as to why. Searching for "host=redacted" or "source='jmx://redacted'" yields nothing.

This is not a complicated setup, nor is it a complicated app. Single server test environment, just trying to get JMX data into Splunk directly instead of having to do some nasty search-time field extraction after indexing data output from JMXTr text files. It's currently running on JDK 1.7, I tried 1.6 for science to no avail.

Install Splunk 6 on your server which contains about 6 different JMX instances. you want to hook all of them up into our Splunk JMX plugin.

It is as easy as editing the config.xml file and adding a new jmx server host? Currently this is:

<jmxserver host="[[system name]]" jvmDescription="common_raw" jmxport="53632">