Java Management Extensions (JMX) Interview Questions & Answers

4 avg. rating (80% score) - 1 votes

Java Management Extensions (JMX) Interview Questions & Answers

Are you prepared in attending an interview? Then do not worry, we’ve a right answer for your job interview preparation. If you are preparing for Java Management Extensions (JMX) job interview and don’t know how to crack interview and what level or difficulty of questions to be asked in job interviews then go through Wisdomjobs Java Management Extensions (JMX) interview questions and answers page to crack your job interview. It is a Java technology that supplies tools for managing and monitoring applications, system objects, devices (such as printers) and service-oriented networks. Those resources are represented by objects called MBeans. Below is the list of frequently asked Java Management Extensions (JMX) interview questions and answers which gets you ready to face the interviews:

Java Management Extensions (JMX) Interview Questions

Java Management Extensions (JMX) Interview Questions
    1. Question 1. How Is The Application Jvm Configured?

      Answer :

      The application JVM is configured with the following options:

      • com.sun.management.jmxremote
      • com.sun.management.jmxremote.port=1088
      • com.sun.management.jmxremote.authenticate=false
      • com.sun.management.jmxremote.ssl=false

    2. Question 2. What Are The Advantages Of Setter Dependency Injection?

      Answer :

      Here are a few advantages of Setter:

      1. Natural for Java Beans
      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

    3. Question 3. How To Access Jmx (java Beans) From A Process Running In Docker Container?

      Answer :

      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
      • Dcom.sun.management.jmxremote.port=$JMX_PORT
      • Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT

    4. Question 4. What Are The Various Actions Performed When An Application Context Is Created?

      Answer :

      Here are 5 steps:

      1. Read bean file XML (or process annotations). Build internal "map" of beans 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

    5. Question 5. What Is A Named Pointcut And Why To Use One?

      Answer :

      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=".."

    6. Question 6. List Some Types Of Advice?

      Answer :

      Types of advice:

      • Before
      • AfterReturning
      • AfterThrowing
      • After
      • Around

    7. Question 7. What Is An Advice In Jmx?

      Answer :

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

    8. Question 8. What Is A Join-point?

      Answer :

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

    9. Question 9. What Is A Cross-cutting Concern?

      Answer :

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

      Examples:

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

    10. Question 10. What Is Lazy Initialization?

      Answer :

      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.

    11. Question 11. What Is A Nested Bean?

      Answer :

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

    12. Question 12. List 2 Examples Of Anonymous Bean?

      Answer :

      Two examples:

      1. Nested or inner beans
      2. Configuration beans

    13. Question 13. What Are The 5 Scopes Defined In Spring?

      Answer :

      5 scopes defined in Spring:

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

    14. Question 14. How Does A Spring Factory Bean Work?

      Answer :

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

    15. Question 15. What Is The Advantage Of Constructor Dependency Injection?

      Answer :

      Here are a few advantages:

      • Constructor
      • Mandatory
      • Mutable
      • Natural Java approach.

    16. Question 16. How Is Setter Dependency Injection Specified A Configuration File?

      Answer :

      <constructor-arg… and <property…

    17. Question 17. How Is Dependency Injection Performed In The Bean-file Xml?

      Answer :

      There are nested elements within each bean definition.

    18. Question 18. Why Is Dependency Injection Useful?

      Answer :

      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).

    19. Question 19. What Is Dependency Injection?

      Answer :

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

    20. Question 20. How To Run Jmx Java Application In Udeploy Process?

      Answer :

      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.

    21. Question 21. How Will You Check If Jmx Agent Is Working In Tomcat?

      Answer :

      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.

    22. Question 22. What If There Is No Jmx Data?

      Answer :

      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 JMXTrans text files. It's currently running on JDK 1.7, I tried 1.6 for science to no avail.

    23. Question 23. How To Connect To Multiple Jmx Instances Using Splunk For Jmx?

      Answer :

      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">

    24. Question 24. What Is Managed Bean Or Mbean?

      Answer :

      A managed bean - sometimes simply referred to as an MBean - is a type of JavaBean, created with dependency injection. Managed Beans 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.

    25. Question 25. What Is Jmx Architecture?

      Answer :

      JMX is based on a 3-level architecture:

      1. The Probe level contains the probes (called MBeans) 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).

    26. Question 26. What Is Jmx?

      Answer :

      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.

    27. Question 27. Explain Jmx Concepts And Architecture?

      Answer :

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

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

    28. Question 28. What Is The Use Of Object Factories?

      Answer :

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

    29. Question 29. Which Is The Best Tool For Monitoring Weblogic Server(wls8)?

      Answer :

      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.

Core Java Tutorial

All Tutorials

All Practice Tests

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Core Java Tutorial