Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1152

Report of WELD-001443 doesn't identify depending *fields*, making diagnosis harder

    XMLWordPrintable

Details

    Description

      There is an opportunity for a usability improvement in Weld's error messages regarding circular dependencies.

      If a circular dependency exists between two unproxyable classes (ie @Dependent scope classes or those in a custom pseudo-scope) then WELD-001443 is raised during deployment scanning. This exception helpfully reports the circular dependency path, but doesn't identify the field(s) involved and the class that each is defined in.

      This makes diagnosis harder than it could be, especially when one or more of the dependencies arises in the parent class of a bean. For example, in the following, it turned out that ModuleHomeScreen did depend on NymmVaadinApplication, but did so via the parent class of ModuleHomeScreen; there was no explicit dependency in ModuleHomeScreen.

      This threw me for a few minutes because ModuleHomeScreen does have an event producer that's observed by NymmVaadinApplication, so I was wondering if that was violating the circular dependency rules too - even though it didn't seem to make much sense. It took a little while to realise the dependency was in the superclass.

      If the error message had identified the depending field(s) at each node in the path, it would've been immediately clear what was going on.

      org.jboss.weld.exceptions.DeploymentException: WELD-001443 Pseudo scoped bean has circular dependencies. Dependency path [Managed Bean [class au.com.postnewspapers.nymm.ui.ModuleHomeScreen] with qualifiers [@Any @Default], Managed Bean [class au.com.postnewspapers.nymm.ui.NymmVaadinApplication] with qualifiers [@Any @Default], Managed Bean [class au.com.postnewspapers.nymm.ui.ModuleHomeScreen] with qualifiers [@Any @Default]]
      	at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:564)
      	at org.jboss.weld.bootstrap.Validator.validatePseudoScopedInjectionPoint(Validator.java:588)
      	at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:571)
      	at org.jboss.weld.bootstrap.Validator.validatePseudoScopedInjectionPoint(Validator.java:588)
      	at org.jboss.weld.bootstrap.Validator.reallyValidatePseudoScopedBean(Validator.java:571)
      	at org.jboss.weld.bootstrap.Validator.validatePseudoScopedBean(Validator.java:550)
      	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:114)
      	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)
      	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
      	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
      	at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
      	at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      	at java.lang.Thread.run(Thread.java:722)
      

      Attachments

        Activity

          People

            marko.luksa@gmail.com Marko Luksa (Inactive)
            ringerc_jira Craig Ringer (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: