Uploaded image for project: 'Tapestry'
  1. Tapestry
  2. TAPESTRY-1596

Contributing a service to the Alias service configuration fails if the service uses a non-standard scope, such as perthread

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 5.0.4
    • 5.0.5
    • tapestry-core, tapestry-ioc
    • None
    • 5.0.5-SNAPSHOT

    Description

      The issue is that the ServiceLifecycleSource service is making indirect use of the Alias service for some of its dependencies. Thus the Alias service must be fully instantiated for SLS to be instantiated, but when contributing a service to Alias, the SLS must be instantiated first, to provide the necessary proxy. Need to defer out the creation of the proxy.

      Caused by: java.lang.RuntimeException: Error invoking service contribution method org.apache.tapestry.ioc.services.TapestryIOCModule.contributeServiceLifecycleSource(MappedConfiguration, ObjectLocator): Error invoking constructor org.apache.tapestry.ioc.internal.services.PerThreadServiceLifecycle(ThreadCleanupHub, ClassFactory) (at PerThreadServiceLifecycle.java:54) (for service 'ServiceLifecycleSource'): Exception constructing service 'Alias': Construction of service 'Alias' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry.services.TapestryModule.build(Log, String, AliasManager, Collection) (at TapestryModule.java:248) for references to another service that is itself dependent on service 'Alias'.
      at org.apache.tapestry.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:112)
      at org.apache.tapestry.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:73)
      at org.apache.tapestry.ioc.internal.RegistryImpl.addToMappedConfiguration(RegistryImpl.java:379)
      at org.apache.tapestry.ioc.internal.RegistryImpl.getMappedConfiguration(RegistryImpl.java:332)
      at org.apache.tapestry.ioc.internal.ServiceResourcesImpl.getMappedConfiguration(ServiceResourcesImpl.java:97)
      at org.apache.tapestry.ioc.internal.AbstractServiceCreator.addMappedConfigurationParameter(AbstractServiceCreator.java:160)

      public PerThreadServiceLifecycle(ThreadCleanupHub threadCleanupHub,
      @InjectService("ClassFactory")
      ClassFactory classFactory)

      { _threadCleanupHub = threadCleanupHub; _classFactory = classFactory; }

      A temporary fix would be for the ThreadCleanupHub to be injected using @InjectService.

      Attachments

        Activity

          People

            hlship Howard Lewis Ship
            hlship Howard Lewis Ship
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: