Tapestry 5
  1. Tapestry 5
  2. TAP5-308

Injecting dependencies into contributeTypeCoercer method causes circular dependency error

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: tapestry-ioc
    • Labels:
      None

      Description

      If the contributeTypeCoercer only has the configuration parameter everything works fine:

      public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration)
      {
      ...
      }

      But if i want to inject into the method any other service or even value like so:

      public static void contributeTypeCoercer(Configuration<CoercionTuple> configuration, Logger logger) {
      }

      I get the following exception:

      java.lang.RuntimeException: Error invoking constructor org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl(Collection) (at TypeCoercerImpl.java:93) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:38) (for service 'TypeCoercer'): Error invoking service contribution method pt.viaverde.ecm.classification.web.services.ClassificacaoModule.contributeTypeCoercer(Configuration, String): Exception constructing service 'TypeCoercer': Construction of service 'TypeCoercer' has failed due to recursion: the service depends on itself in some way. Please check org.apache.tapestry5.ioc.internal.services.TypeCoercerImpl(Collection) (at TypeCoercerImpl.java:93) via org.apache.tapestry5.ioc.services.TapestryIOCModule.bind(ServiceBinder) (at TapestryIOCModule.java:38) for references to another service that is itself dependent on service 'TypeCoercer'.
      at org.apache.tapestry5.ioc.internal.ConstructorServiceCreator.createObject(ConstructorServiceCreator.java:63)
      at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
      at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:52)
      at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
      at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:65)
      at $TypeCoercer_11d26e6f77f.delegate($TypeCoercer_11d26e6f77f.java)
      at $TypeCoercer_11d26e6f77f.coerce($TypeCoercer_11d26e6f77f.java)
      at org.apache.tapestry5.ioc.internal.services.ValueObjectProvider.provide(ValueObjectProvider.java:58)
      at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:38)
      at $MasterObjectProvider_11d26e6f77b.provide($MasterObjectProvider_11d26e6f77b.java)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:626)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:733)
      at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:49)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:205)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:235)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:214)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:67)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.create(ModuleImpl.java:233)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.access$100(ModuleImpl.java:35)
      at org.apache.tapestry5.ioc.internal.ModuleImpl$1.invoke(ModuleImpl.java:168)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:138)
      at org.apache.tapestry5.ioc.internal.ModuleImpl$2.invoke(ModuleImpl.java:185)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.findOrCreate(ModuleImpl.java:192)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.getService(ModuleImpl.java:89)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:303)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.findServiceByMarkerAndType(RegistryImpl.java:684)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:619)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:733)
      at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:49)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:205)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:235)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParametersForMethod(InternalUtils.java:214)
      at org.apache.tapestry5.ioc.internal.ContributionDefImpl.invokeMethod(ContributionDefImpl.java:90)
      at org.apache.tapestry5.ioc.internal.ContributionDefImpl.contribute(ContributionDefImpl.java:56)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.addToUnorderedConfiguration(RegistryImpl.java:481)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getUnorderedConfiguration(RegistryImpl.java:355)
      at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getUnorderedConfiguration(ServiceResourcesImpl.java:72)
      at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.addUnorderedConfigurationParameter(AbstractServiceCreator.java:140)
      at org.apache.tapestry5.ioc.internal.AbstractServiceCreator.getParameterDefaultsWithConfiguration(AbstractServiceCreator.java:106)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.getParameterDefaultsWithConfigurations(ServiceBuilderMethodInvoker.java:46)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:67)
      at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
      at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:52)
      at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:50)
      at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
      at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:65)
      at $Alias_11d26e6f77c.delegate($Alias_11d26e6f77c.java)
      at $Alias_11d26e6f77c.getObjectProvider($Alias_11d26e6f77c.java)
      at org.apache.tapestry5.services.TapestryModule$1.provide(TapestryModule.java:556)
      at org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:38)
      at $MasterObjectProvider_11d26e6f77b.provide($MasterObjectProvider_11d26e6f77b.java)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:626)
      at org.apache.tapestry5.ioc.internal.RegistryImpl.getObject(RegistryImpl.java:733)
      at org.apache.tapestry5.ioc.internal.ObjectLocatorImpl.getObject(ObjectLocatorImpl.java:49)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameterValue(InternalUtils.java:205)
      at org.apache.tapestry5.ioc.internal.util.InternalUtils.calculateParameters(InternalUtils.java:235)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.constructModuleBuilder(ModuleImpl.java:337)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.access$400(ModuleImpl.java:35)
      at org.apache.tapestry5.ioc.internal.ModuleImpl$3.run(ModuleImpl.java:274)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier$2.invoke(ConcurrentBarrier.java:198)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier$2.invoke(ConcurrentBarrier.java:196)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:138)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withWrite(ConcurrentBarrier.java:204)
      at org.apache.tapestry5.ioc.internal.ModuleImpl$4.invoke(ModuleImpl.java:282)
      at org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:83)
      at org.apache.tapestry5.ioc.internal.ModuleImpl.getModuleBuilder(ModuleImpl.java:290)
      at org.apache.tapestry5.ioc.internal.ServiceResourcesImpl.getModuleBuilder(ServiceResourcesImpl.java:105)
      at org.apache.tapestry5.ioc.internal.ServiceBuilderMethodInvoker.createObject(ServiceBuilderMethodInvoker.java:59)
      at org.apache.tapestry5.ioc.internal.SingletonServiceLifecycle.createService(SingletonServiceLifecycle.java:29)
      at org.apache.tapestry5.ioc.internal.LifecycleWrappedServiceCreator.createObject(LifecycleWrappedServiceCreator.java:52)
      at org.apache.tapestry5.ioc.internal.InterceptorStackBuilder.createObject(InterceptorStackBuilder.java:50)
      at org.apache.tapestry5.ioc.internal.RecursiveServiceCreationCheckWrapper.createObject(RecursiveServiceCreationCheckWrapper.java:60)
      at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:65)
      at $ServletApplicationInitializer_11d26e6f77a.delegate($ServletApplicationInitializer_11d26e6f77a.java)
      at $ServletApplicationInitializer_11d26e6f77a.initializeApplication($ServletApplicationInitializer_11d26e6f77a.java)
      at org.apache.tapestry5.TapestryFilter.init(TapestryFilter.java:91)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:223)
      at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
      at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3598)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4168)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
      at org.apache.catalina.startup.Embedded.start(Embedded.java:821)
      at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:253)
      at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:113)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      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 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

        Activity

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development