Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-22103

(7.4.z) WFLY-14792 - ParsedServiceDeploymentProcessor unnecessarily does deep reflection on JDK classes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 7.4.4.CR1, 7.4.4.GA
    • None
    • None

    Description

      Running with SE 16 or later I see ServiceMBeanSupportTestCase:

      &amp#27;[0m&amp#27;[31m22:11:08,100 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."service-mbean-support-test.sar".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."service-mbean-support-test.sar".INSTALL: WFLYSRV0153: Failed to process phase INSTALL of deployment "service-mbean-support-test.sar"
      	at org.jboss.as.server@16.0.0.Beta4-SNAPSHOT//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
      	at org.jboss.msc@1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
      	at org.jboss.msc@1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
      	at org.jboss.msc@1.4.12.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
      	at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.base/java.lang.Thread.run(Thread.java:831)
      Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class javax.management.NotificationBroadcasterSupport with ClassLoader null
      	at org.jboss.as.server@16.0.0.Beta4-SNAPSHOT//org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:78)
      	at org.jboss.as.sar@24.0.0.Beta1-SNAPSHOT//org.jboss.as.service.ReflectionUtils.getClassHierarchy(ReflectionUtils.java:150)
      	at org.jboss.as.sar@24.0.0.Beta1-SNAPSHOT//org.jboss.as.service.ParsedServiceDeploymentProcessor.addServices(ParsedServiceDeploymentProcessor.java:119)
      	at org.jboss.as.sar@24.0.0.Beta1-SNAPSHOT//org.jboss.as.service.ParsedServiceDeploymentProcessor.deploy(ParsedServiceDeploymentProcessor.java:109)
      	at org.jboss.as.server@16.0.0.Beta4-SNAPSHOT//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
      	... 8 more
      Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.util.List javax.management.NotificationBroadcasterSupport.listenerList accessible: module java.management does not "opens javax.management" to unnamed module @3586df04
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
      	at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
      	at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:177)
      	at java.base/java.lang.reflect.Field.setAccessible(Field.java:171)
      	at org.jboss.as.server@16.0.0.Beta4-SNAPSHOT//org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:75)
      	at org.jboss.as.server@16.0.0.Beta4-SNAPSHOT//org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
      	... 12 more
      

      The issue is org.jboss.as.service.ReflectionUtils.getClassHierarchy is reflecting on the entire class hierarchy, and in a common case that hierarchy will include ServiceMBeanSupport and NotificationBroadcasterSupport. And it will include Object.

      Unless NotificationBroadcasterSupport or Object are the initial type, the results of ReflectionUtils.getClassHierarchy are never used for anything where NotificationBroadcasterSupport or Object are relevant. The results are searched for create/start/stop/destroy methods or for setters, neither of which are available from NotificationBroadcasterSupport or Object. So, ReflectionUtils.getClassHierarchy shouldn't index those two type unless they are the initial type.

      Attachments

        Issue Links

          Activity

            People

              bstansbe@redhat.com Brian Stansberry
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: