Uploaded image for project: 'Seam 2'
  1. Seam 2
  2. JBSEAM-1583

seam:component intercept uses Seam standard rules by default

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.0.BETA1
    • Fix Version/s: 2.0.0.CR1
    • Component/s: Spring
    • Labels:
      None

      Description

      From spring-seam-2.0.xsd, intercept:

      Determines whether Seam interceptors should be wrapped around a bean, by overriding Seam's default rules.
      Seldom do you want the seam interceptors wrapped around a sprig singleton. Auto will use choose no
      interception for a singleton and use Seam standard rules otherwise.

      Looking at the code, I can't find anything about this "no interception for a singleton" default.
      This bean

      <bean id="processRepository" class="se.lantmateriet.wfl.dataaccess.WsProcessRepository">
      <constructor-arg value="http://localhost/avtal/avtalservice.asmx"/>
      <seam:component/>
      </bean>

      fails like this:

      12:45:35,203 DEBUG [ProxyUtils] Creating proxy for Spring Seam component 'processRepository' using class: se.lantmateriet.wfl.dataaccess.WsProcessRepository
      12:45:35,282 INFO [DefaultListableBeanFactory] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@8c2d94: defining beans [org.jboss.seam.ioc.spring.seamComponentPostProcessor,processRepository]; root of factory hierarchy
      12:45:35,297 ERROR [[/wfl-seam]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processRepository' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.jboss.seam.InstantiationException: Could not instantiate Seam component: processRepository
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:430)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:255)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:252)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:689)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:358)
      at org.jboss.seam.ioc.spring.ContextLoader.startupContextLoader(ContextLoader.java:64)
      at org.jboss.seam.ioc.spring.ContextLoader.create(ContextLoader.java:43)
      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.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
      at org.jboss.seam.Component.callCreateMethod(Component.java:1880)
      at org.jboss.seam.Component.newInstance(Component.java:1859)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:98)
      at org.jboss.seam.init.Initialization.init(Initialization.java:508)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:34)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
      Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: processRepository
      at org.jboss.seam.Component.newInstance(Component.java:1853)
      at org.jboss.seam.Component.getInstance(Component.java:1756)
      at org.jboss.seam.Component.getInstance(Component.java:1735)
      at org.jboss.seam.Component.getInstance(Component.java:1729)
      at org.jboss.seam.ioc.spring.SeamComponentPostProcessor.postProcessAfterInitialization(SeamComponentPostProcessor.java:49)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:314)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1184)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:407)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:255)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:252)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:689)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:358)
      at org.jboss.seam.ioc.spring.ContextLoader.startupContextLoader(ContextLoader.java:64)
      at org.jboss.seam.ioc.spring.ContextLoader.create(ContextLoader.java:43)
      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.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
      at org.jboss.seam.Component.callCreateMethod(Component.java:1880)
      at org.jboss.seam.Component.newInstance(Component.java:1859)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
      at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
      at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:98)
      at org.jboss.seam.init.Initialization.init(Initialization.java:508)
      Caused by: java.lang.InstantiationException: se.lantmateriet.wfl.dataaccess.WsProcessRepository_$$_javassist_0
      at java.lang.Class.newInstance0(Class.java:340)
      at java.lang.Class.newInstance(Class.java:308)
      at org.jboss.seam.ioc.ProxyUtils.enhance(ProxyUtils.java:71)
      at org.jboss.seam.ioc.IoCComponent.instantiateJavaBean(IoCComponent.java:94)
      at org.jboss.seam.Component.instantiate(Component.java:1154)
      at org.jboss.seam.Component.newInstance(Component.java:1849)
      at org.jboss.seam.Component.getInstance(Component.java:1756)
      at org.jboss.seam.Component.getInstance(Component.java:1735)
      at org.jboss.seam.Component.getInstance(Component.java:1729)
      at org.jboss.seam.ioc.spring.SeamComponentPostProcessor.postProcessAfterInitialization(SeamComponentPostProcessor.java:49)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:314)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1184)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:407)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:255)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:252)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:689)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:358)
      at org.jboss.seam.ioc.spring.ContextLoader.startupContextLoader(ContextLoader.java:64)
      at org.jboss.seam.ioc.spring.ContextLoader.create(ContextLoader.java:43)
      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.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:124)
      at org.jboss.seam.Component.callComponentMethod(Component.java:1957)
      at org.jboss.seam.Component.callCreateMethod(Component.java:1880)

      If I change <seam:component/> to <seam:component intercept="false"/> everything works.

      1. Default for stateless spring beans seems to be true since seam standard rules are applied if intercept is null, that is not defined. bug?

      2. Why would I want to use intercept="true" anyway? What interceptors will be added?

      3. Why is it failing with intercept="true"?

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  manaRH Marek Novotny
                  Reporter:
                  magnusheino Magnus Heino
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: