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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.4
    • Fix Version/s: 5.0.5
    • Component/s: tapestry-core, tapestry-ioc
    • Labels:
      None
    • Environment:
      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.

        Activity

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Howard M. Lewis Ship
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development