Tapestry 5
  1. Tapestry 5
  2. TAP5-892

Use of Injection to provide Locale instances to components breaks when multiple Locales are configured as Spring Beans in AppContext

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0.5
    • Fix Version/s: 5.3
    • Component/s: tapestry-spring
    • Labels:
      None

      Description

      Certain components such as Select have java.util.Locale injected into it. With tapestry-spring-5.1.0.5, this creates a problem if you have Locale beans configured in your Spring application Context (externally maintained with tapestry.use-external-spring-context) as below.
      <bean id="locale_US" class="java.util.Locale"><constructor-arg index="0" value="en" /><constructor-arg index="1" value="US" /></bean>
      <bean id="locale_UK" class="java.util.Locale"><constructor-arg index="0" value="en" /><constructor-arg index="1" value="GB" /></bean>

      This worked fine in Tapestry 5.0.18, but became a problem in 5.1. Currently, I managed to get 5.1.0.5 of Tapestry running with tapestry-spring-5.0.18, but this problem persists in tapestry-spring-5.1.0.5

      Shouldn't tapestry be looking at the request to see which Locale it is for? Why is it going into Spring's application context?

      Render queue error in
      SetupRender[LayoutBlocks:hbflayout]: Exception
      assembling root component of page ComponentBlocks:
      Exception assembling embedded component 'signupFormComponent' (of type
      com.example.components.form.SignupFormComponent, within ComponentBlocks): Failure creating embedded component
      'layoutSelectField' of
      com.example.components.ComponentEditorPanel:
      java.lang.ClassNotFoundException: caught an exception while obtaining a
      class file for org.apache.tapestry5.corelib.components.Select

      • java.lang.ClassNotFoundException
        caught an exception while obtaining a class file for org.apache.tapestry5.corelib.components.Select
        exception
        org.apache.tapestry5.internal.services.TransformationException:
        Error obtaining injected value for field
        org.apache.tapestry5.corelib.components.Select.locale: Spring context
        contains 4 beans assignable to type java.util.Locale: locale_DE,
        locale_FR, locale_UK, locale_US.
      • org.apache.tapestry5.internal.spring.SpringModuleDef$4$1.provide(SpringModuleDef.java:258)
      • org.apache.tapestry5.internal.spring.SpringModuleDef$4$2$1.invoke(SpringModuleDef.java:274)
      • org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
      • org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      • org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
      • org.apache.tapestry5.internal.spring.SpringModuleDef$4$2.provide(SpringModuleDef.java:268)
      • org.apache.tapestry5.internal.spring.SpringModuleDef$4$3.provide(SpringModuleDef.java:290)
      • org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl$1.invoke(MasterObjectProviderImpl.java:48)
      • org.apache.tapestry5.ioc.internal.OperationTrackerImpl.invoke(OperationTrackerImpl.java:68)
      • org.apache.tapestry5.ioc.internal.PerThreadOperationTracker.invoke(PerThreadOperationTracker.java:68)
      • org.apache.tapestry5.ioc.internal.RegistryImpl.invoke(RegistryImpl.java:941)
      • org.apache.tapestry5.ioc.internal.services.MasterObjectProviderImpl.provide(MasterObjectProviderImpl.java:41)
      • $MasterObjectProvider_1244929e11f.provide($MasterObjectProvider_1244929e11f.java)
      • org.apache.tapestry5.internal.services.DefaultInjectionProvider.provideInjection(DefaultInjectionProvider.java:58)
      • $InjectionProvider_1244929e193.provideInjection($InjectionProvider_1244929e193.java)
      • $InjectionProvider_1244929e18b.provideInjection($InjectionProvider_1244929e18b.java)
      • org.apache.tapestry5.internal.transform.InjectWorker.transform(InjectWorker.java:57)
      • $ComponentClassTransformWorker_1244929e191.transform($ComponentClassTransformWorker_1244929e191.java)
      • $ComponentClassTransformWorker_1244929e187.transform($ComponentClassTransformWorker_1244929e187.java)
      • org.apache.tapestry5.internal.services.ComponentClassTransformerImpl.transformComponentClass(ComponentClassTransformerImpl.java:170)
      • $ComponentClassTransformer_1244929e13e.transformComponentClass($ComponentClassTransformer_1244929e13e.java)
      • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.onLoad(ComponentInstantiatorSourceImpl.java:205)
      • javassist.Loader.findClass(Loader.java:340)
      • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl$PackageAwareLoader.findClass(ComponentInstantiatorSourceImpl.java:94)
      • javassist.Loader.loadClass(Loader.java:311)
      • java.lang.ClassLoader.loadClass(ClassLoader.java:251)
      • org.apache.tapestry5.internal.services.ComponentInstantiatorSourceImpl.findClass(ComponentInstantiatorSourceImpl.java:296)

        Activity

        Dave Greggory created issue -
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 5.3 [ 12316024 ]
        Resolution Fixed [ 1 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development