Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to register MXBeans on MBeanServer in JBoss 4.2.3 (running on JDK 1.6)  RSS feed

 
Deepak Chenani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

We are migrating our product from JDK 1.5 to JDK 1.6.
While deploying the application on JBoss 4.2.3 it throws following exception:

This exception is thrown while registering the java.lang.management.ClassLoadingMXBean on the MBeanServer.

The same code works as expected on JBoss 4.2.3 with JDK 1.5.

We have deployed the same application without any issues on Weblogic 11g and Websphere 7.

Has anyone faced such an issue? What is the cause and remedy?

Regards,
Deepak
 
Devaka Cooray
Marshal
Posts: 5390
611
Chrome Eclipse IDE Google App Engine IntelliJ IDE jQuery Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Deepak Ch", please check your private messages regarding an important administrative matter.
 
Deepak Chenani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Finally, I found the cause of the issue. But still need to get a solution.

What I found is that in JBoss App Server before registering any MBean passes the MBean Class to the org.jboss.mx.metadata.MBeanCapability.of(Class mbeanClass). Here it checks whether the MBean is DynamicMBean, StandardMBean, or the Class extends an MBean interface.

I wrote a similar code where I tried to pass the java.lang.ClassLoadingMXBean through this check (downloaded the JBoss 4.2.3 source code).
Executed the same code with JDK 1.5 and JDK 1.6.

My Observations:

JDK 1.5: It seems that the sun.management.ClassLoadingImpl is a DynamicMBean since it returns true for the statement DynamicMBean.class.isAssignableFrom(mbeanClass). Also the super class of ClassLoadingImpl is displayed as sun.management.MXBeanSupport

JDK 1.6: Returns false for the statement: DynamicMBean.isAssignableFrom(mbeanClass). The superclass of ClassLoadingImpl is displayed as java.lang.Object.

JDK 1.5 covers JMX 1.2 Specification whereas JDK 1.6 covers JMX 1.4 Specification (Did some googling)

JDK 1.6 now enables us to create our own MXBeans as well as use the ones in the java.lang.management package.

Assumption:

Currently, JBoss 4.2.3 is not able to handle or verify if the MBean is an MXBean. Some code fix is required in the org.jboss.mx.metadata.MBeanCapability.of(Class mbeanClass) method.

I get same error with JBoss 6.x as well.

I can modify the source code and make it functional but our clients use the EAP version. So I am not sure how can this be handled.

Please let me know if you have a solution to fix this issue.

Regards,
Deepak Chainani
 
Deepak Chenani
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Finally, I was able to find a workaround to resolve the issue. I had to make some changes in my code.

JDK 6 provides a new StandardMBean constructor to wrap the MXBeans as DynamicMBeans:


StandardMBean(T implementation, Class<T> mbeanInterface, boolean isMXBean)

Refer: http://java.sun.com/javase/6/docs/api/javax/management/StandardMBean.html#StandardMBean(T, java.lang.Class, boolean)

This would be only done when the application is deployed on JBoss AppServer, reason being our application is certified to run with Weblogic and WebSphere and it does get deployed successfully without any code changes.

But, now the only thing I am unable to figure out is ThreadMXBean when registered in the MBean Server, causes the JConsole to disconnect from the MBeanServer. So, as a workaround, currently the ThreadMXBean will not be registered, if the application is deployed on JBoss AppServer.

Please let me know if there is any solution to register the ThreadMXBean.

Regards,
Deepak
 
Ramkumar Krishnan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deepak and all,
      I am facing the same exact issue when I use HikariCP 2.4.x inside my JBoss 4.2.3. Did you solve this issue?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!