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

        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/)
        TAP5-892: Use of Injection to provide Locale instances to components breaks when multiple Locales are configured as Spring Beans in AppContext
        TAP5-892: Set minimum servlet API version to 2.5
        Create test to identify incorrect Locale injection (from Spring context)

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185405
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CommonResourcesInjectionProvider.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BadMixinIdDemo.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DupeMixinDemo.tml
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Publish3.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DupeMixinDemo.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventDispatcherTest.java
        • /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImplTest.java
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/pages/Start.java
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185404
        Files :

        • /tapestry/tapestry5/trunk/build.gradle
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/pages/Start.java
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml
        • /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/ ) TAP5-892 : Use of Injection to provide Locale instances to components breaks when multiple Locales are configured as Spring Beans in AppContext TAP5-892 : Set minimum servlet API version to 2.5 Create test to identify incorrect Locale injection (from Spring context) hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185405 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Form.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/CommonResourcesInjectionProvider.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/DefaultInjectionProvider.java /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/BadMixinIdDemo.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/app1/DupeMixinDemo.tml /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/components/Publish3.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/DupeMixinDemo.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventDispatcherTest.java /tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImplTest.java /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/apache/tapestry5/spring/TapestrySpringIntegrationTest.java /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/pages/Start.java /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185404 Files : /tapestry/tapestry5/trunk/build.gradle /tapestry/tapestry5/trunk/tapestry-spring/src/test/java/org/example/testapp/pages/Start.java /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/Start.tml /tapestry/tapestry5/trunk/tapestry-spring/src/test/webapp/WEB-INF/applicationContext.xml

          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