Tapestry 5
  1. Tapestry 5
  2. TAP5-602

Contributing to TypeCoercer with service fails even with @InjectService

    Details

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

      Description

      This is somewhat related to TAPESTRY-1558. That JIRA mentions a workaround to avoid self-reference on startup using @InjectService by name rather than standard @Inject. However, between 5.1.0.1 and the 5.1.0.2 snapshot this workaround has stopped working.

      I am having trouble producing a simple test case for this but will attempt to do so and post it here.

      1. tapestry_log.txt
        354 kB
        Alfie Kirkpatrick

        Activity

        Hide
        Howard M. Lewis Ship added a comment -

        I don't really have a test case for this, but from the log, it was clear the problem was a missing @Bulitin in PerThreadServiceLifecycle, which forces the creation of the Alias service right in the middle of instantiating the Alias service.

        Show
        Howard M. Lewis Ship added a comment - I don't really have a test case for this, but from the log, it was clear the problem was a missing @Bulitin in PerThreadServiceLifecycle, which forces the creation of the Alias service right in the middle of instantiating the Alias service.
        Hide
        Alfie Kirkpatrick added a comment -

        I get the point about it being a grey area, just about

        Am attaching the log from startup. I have also tried to add @InjectService("PerthreadManager") to the invocation of buildJcrSession but this didn't help so not sure where to go from here. Perhaps the dependencies of PerthreadManager have changed in some way in 5.1.0.2. I've been back and forth between 5.1.01 and 5.1.0.2-SNAPSHOT so am confident this issue was introduced between these two versions.

        Kind regards, Alfie.

        Show
        Alfie Kirkpatrick added a comment - I get the point about it being a grey area, just about Am attaching the log from startup. I have also tried to add @InjectService("PerthreadManager") to the invocation of buildJcrSession but this didn't help so not sure where to go from here. Perhaps the dependencies of PerthreadManager have changed in some way in 5.1.0.2. I've been back and forth between 5.1.01 and 5.1.0.2-SNAPSHOT so am confident this issue was introduced between these two versions. Kind regards, Alfie.
        Hide
        Howard M. Lewis Ship added a comment -

        Yes about the incorrect message.

        Injecting a service injects a proxy; what's happening is that the MasterObjectDispatcher is asking the TypeCoercer to coerce a value, the TypeCoercer is then using your contribution (the service proxy). Invoking a method on the proxy lazy instantiates the service, which needs the MOD and the TypeCoercer to handle your dependency.

        TypeCoercer (and other contributions related to injection and the MasterObjectDispatcher) are finicky because they fall into a somewhat grey area between setup/startup of the Registry and full operation. That's the downside of trying to defining parts of Tapestry 5 IoC in Tapestry 5 IoC. In any event, you may need to make your dependency into your service implementation unambiguous ... use @InjectService there as well.

        T5.1 does a great job of diagnosing what it was doing leading up to the injection error, could we see that part of the logging output?

        Show
        Howard M. Lewis Ship added a comment - Yes about the incorrect message. Injecting a service injects a proxy; what's happening is that the MasterObjectDispatcher is asking the TypeCoercer to coerce a value, the TypeCoercer is then using your contribution (the service proxy). Invoking a method on the proxy lazy instantiates the service, which needs the MOD and the TypeCoercer to handle your dependency. TypeCoercer (and other contributions related to injection and the MasterObjectDispatcher) are finicky because they fall into a somewhat grey area between setup/startup of the Registry and full operation. That's the downside of trying to defining parts of Tapestry 5 IoC in Tapestry 5 IoC. In any event, you may need to make your dependency into your service implementation unambiguous ... use @InjectService there as well. T5.1 does a great job of diagnosing what it was doing leading up to the injection error, could we see that part of the logging output?
        Hide
        Alfie Kirkpatrick added a comment -

        Hi Howard, did you mean to post your last comment to another JIRA?!

        I have attempted to reproduce the problem I'm having in a simpler project to no avail, but the problem is definitely there. Any ideas about how to diagnose it in-place?

        Basically I am injecting a service into the contributeTypeCoercer method and this service has a dependency on another service in a sub-module.

        Show
        Alfie Kirkpatrick added a comment - Hi Howard, did you mean to post your last comment to another JIRA?! I have attempted to reproduce the problem I'm having in a simpler project to no avail, but the problem is definitely there. Any ideas about how to diagnose it in-place? Basically I am injecting a service into the contributeTypeCoercer method and this service has a dependency on another service in a sub-module.
        Hide
        Howard M. Lewis Ship added a comment -

        A new service, ClientInfrastructure, encapsulates what JavaScript and CSS stylesheet assets are automatically added, so it's one-stop shopping for overrides.

        Show
        Howard M. Lewis Ship added a comment - A new service, ClientInfrastructure, encapsulates what JavaScript and CSS stylesheet assets are automatically added, so it's one-stop shopping for overrides.
        Hide
        Howard M. Lewis Ship added a comment -

        I can't think of anything that would have changed between the two releases to account for this. There have been very few changes in IoC for 5.1.0.2.

        Show
        Howard M. Lewis Ship added a comment - I can't think of anything that would have changed between the two releases to account for this. There have been very few changes in IoC for 5.1.0.2.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development