JProfiler against JBossAS 6.x fails to boot

Version 1
    Problem

    When using JProfiler (5.x or 6.x) with JBoss AS 6.0.x or later, you will see this exception during the server boot:

     


    14:06:58,531 ERROR [AbstractKernelController] Error installing to 
    Configured: name=ServiceBindingManager state=Configured: 
    java.lang.Exception: Error calling callback JMXRegistrationAdvice for 
    target context ServiceBindingManager
             at 
    org.jboss.dependency.plugins.AbstractLifecycleCallbackItem.install(AbstractLifecycleCallbackItem.java:91)
             at 
    org.jboss.dependency.plugins.AbstractController.handleLifecycleCallbacks(AbstractController.java:1830)
             at 
    ...
    Caused by: javax.management.InstanceNotFoundException: 
    JMImplementation:type=MBeanRegistry
             at 
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1094)
             at 
    com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
             at 
    com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
             at 
    org.jboss.system.microcontainer.jmx.ServiceControllerRegistrationLifecycleCallback.install(ServiceControllerRegistrationLifecycleCallback.java:96)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at 
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at 
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:597)
             at 
    ...
    

     

     

    Workaround

     

    Edit the JBoss AS startup script run.conf (for Windows OS, edit the run.conf.bat) and through the JAVA_OPTS pass the following two system properties:

     

    -Djboss.platform.mbeanserver -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl
    

     

    For example, after changes, the JAVA_OPTS section will look like:

    JAVA_OPTS="-Xms128m -Xmx512m -XX:MaxPermSize=256m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.platform.mbeanserver -Djavax.management.builder.initial=org.jboss.system.server.jmx.MBeanServerBuilderImpl"