11 Replies Latest reply on Jan 2, 2008 11:44 AM by Tom N

    @Factory method kills my @In fields

    Tom N Newbie

      I've narrowed this down as much as possible... Basically I have an @Factory method in stateless action bean. When I hit the page, I get:

      In attribute requires non-null value: test.entity
      


      The same happens if the action is a stateful SB.

      Here is a simple example which duplicates the behavior:

      view/test.xhtml
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.org/rich"
       template="layout/template.xhtml">
      
      <ui:define name="body">
      
       <h:messages globalOnly="true" styleClass="message"/>
      
       <rich:panel>
       <f:facet name="header">Test!</f:facet>
      
       <h:form>
       <h:inputText value='#{testProfile.profileName}' />
       <h:commandButton type="submit" value='Create' action='#{test.biteMe}' />
      
       <h:dataTable value='#{something}' var='profile'>
       <h:column>
       <f:facet name='header'><h:outputText value='Name' /></f:facet>
       <h:outputText value='#{profile.profileName}' />
       </h:column>
       </h:dataTable>
       </h:form>
      
       </rich:panel>
      
      </ui:define>
      </ui:composition>
      


      action/TestImpl.java:
      import java.util.ArrayList;
      import java.util.List;
      import javax.ejb.Stateless;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Logger;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.log.Log;
      
      @Stateless
      @Name("test")
      public class TestImpl implements Test {
       @Logger Log log;
      
       public void biteMe() {
       log.info( entity.getName() );
       something.add(entity);
       }
      
       @In(scope=ScopeType.EVENT) private TestEntity entity;
      
       @DataModel(scope=ScopeType.PAGE) List<TestEntity> something;
      
       @Factory("something") public List<TestEntity> initSomething() {
       List<TestEntity> list = new ArrayList<TestEntity>();
       return list;
       }
      }
      


      action/Test.java
      import java.util.List;
      import test.model.TestEntity;
      import com.enernoc.ess.emulator.model.configuration.Profile;
      
      public interface Test {
       public void biteMe();
       public List<TestEntity> initSomething();
      }
      


      model/TestEntity.java
      import javax.persistence.Entity;
      import javax.persistence.GeneratedValue;
      import javax.persistence.Id;
      import javax.persistence.Version;
      
      import org.jboss.seam.annotations.Name;
      
      @Entity
      @Name("testEntity")
      public class TestEntity {
       @Id @GeneratedValue private Long ID;
       @Version private Long version;
      
       private String name;
      
       public String getName() { return this.name; }
       public void setName(String name) { this.name = name; }
      }
      


      Any help would be greatly appreciated... This is so simple I can't see why it wouldn't work. The @Factory annotation says it is only responsible for the named field, meaning it is only a factory for "something," not "entity".

      THanks.

        • 1. Re: @Factory method kills my @In fields
          Pete Muir Master

          Seam injects by variable name, not by type so try @In TestEntity testEntity;

          • 2. Re: @Factory method kills my @In fields
            Tom N Newbie

             

            "pete.muir@jboss.org" wrote:
            Seam injects by variable name, not by type so try @In TestEntity testEntity;


            Hmm nope, sorry that did not help. Same error. Here is the updated code snice I realized I had a typo in my template as well:

            TestImpl.java
            import java.util.ArrayList;
            import java.util.List;
            
            import javax.ejb.Stateless;
            
            import org.jboss.seam.ScopeType;
            import org.jboss.seam.annotations.Factory;
            import org.jboss.seam.annotations.In;
            import org.jboss.seam.annotations.Logger;
            import org.jboss.seam.annotations.Name;
            import org.jboss.seam.annotations.datamodel.DataModel;
            import org.jboss.seam.log.Log;
            
            @Stateless
            @Name("test")
            public class TestImpl implements Test {
             @Logger Log log;
            
             public void biteMe() {
             log.info( testEntity.getName() );
             something.add(testEntity);
             }
            
             @In(scope=ScopeType.EVENT) private TestEntity testEntity;
            
             @DataModel(scope=ScopeType.PAGE) List<TestEntity> something;
            
             @Factory("something")
             public List<TestEntity> initSomething() {
             List<TestEntity> list = new ArrayList<TestEntity>();
             return list;
             }
            }
            


            test.xhtml:
            <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
            <ui:composition xmlns="http://www.w3.org/1999/xhtml"
             xmlns:s="http://jboss.com/products/seam/taglib"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:rich="http://richfaces.org/rich"
             template="layout/template.xhtml">
            
            <ui:define name="body">
            
             <h:messages globalOnly="true" styleClass="message"/>
            
             <rich:panel>
             <f:facet name="header">Test!</f:facet>
            
             <h:form>
             <h:inputText value='#{testEntity.name}' />
             <h:commandButton type="submit" value='Create' action='#{test.biteMe}' />
            
             <h:dataTable value='#{something}' var='profile'>
             <h:column>
             <f:facet name='header'><h:outputText value='Name' /></f:facet>
             <h:outputText value='#{profile.profileName}' />
             </h:column>
             </h:dataTable>
             </h:form>
            
             </rich:panel>
            
            </ui:define>
            </ui:composition>
            


            For real... Comment out that "@Factory" annotation and suddenly it works (of course the list is not initialized then...) Any other ideas?

            Thanks again.

            • 3. Re: @Factory method kills my @In fields
              Tom N Newbie

              I should also mention this is on Seam 2.0.0CR1 and JBoss AS 4.2.1 GA.

              • 4. Re: @Factory method kills my @In fields
                Pete Muir Master

                You don't want the @DataModel and the @Factory outjecting to the same context variable either. Post the exception and stack trace you are getting.

                • 5. Re: @Factory method kills my @In fields
                  Tom N Newbie

                   

                  "pete.muir@jboss.org" wrote:
                  You don't want the @DataModel and the @Factory outjecting to the same context variable either. Post the exception and stack trace you are getting.


                  The idea was that the factory should be populating that DataModel. I'm following the example given in "Beginning JBoss Seam" (Apress) Ch.5, listing 5-19. The example is as follows:
                  @Stateful
                  @Name("something")
                  public class HouseManagerAction implements... {
                  
                   @DataModelSelection ...
                  
                   @DataModel List<House> houses
                  
                   @Factory("houses") public void findHomes() {
                   houses = em.createQuery( /* query here */ );
                   }
                  }
                  


                  I'm basically trying to do the same thing except I have an @In field as well which is used for something else.

                  Here is my stack trace (I tried upgrading to Seam 2.0.0 GA just in case; it didn't help any )

                  javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: deploymentManager.deployment
                   at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                   at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                   at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                   at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:204)
                   at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:100)
                   at $Proxy450.initSomething(Unknown Source)
                   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.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                   at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                   at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                   at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                   at org.javassist.tmp.java.lang.Object_$$_javassist_1.initSomething(Object_$$_javassist_1.java)
                   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:125)
                   at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
                   at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1918)
                   at org.jboss.seam.Component.getInstance(Component.java:1855)
                   at org.jboss.seam.Component.getInstance(Component.java:1832)
                   at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
                   at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
                   at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
                   at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
                   at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
                   at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                   at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
                   at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                   at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
                   at javax.faces.component.UIData.getValue(UIData.java:582)
                   at javax.faces.component.UIData.getDataModel(UIData.java:1063)
                   at javax.faces.component.UIData.setRowIndex(UIData.java:417)
                   at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:85)
                   at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
                   at javax.faces.component.UIData.encodeBegin(UIData.java:879)
                   at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
                   at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
                   at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
                   at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
                   at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
                   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                   at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
                   at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                   at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                   at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                   at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                   at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                   at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                   at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                   at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                   at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                   at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                   at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                   at java.lang.Thread.run(Thread.java:619)
                  Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: deploymentManager.deployment
                   at org.jboss.seam.Component.getValueToInject(Component.java:2160)
                   at org.jboss.seam.Component.injectAttributes(Component.java:1590)
                   at org.jboss.seam.Component.inject(Component.java:1408)
                   at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                   at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                   at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                   at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                   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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                   at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                   at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                   at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                   ... 108 more
                  


                  Thanks again.

                  • 6. Re: @Factory method kills my @In fields
                    Pete Muir Master

                    The signature of

                    public List<TestEntity> initSomething() {


                    and

                    @Factory("houses") public void findHomes() {


                    is different.

                    Post the code for deploymentManager then...

                    • 7. Re: @Factory method kills my @In fields
                      Tom N Newbie

                       

                      "pete.muir@jboss.org" wrote:
                      The signature of

                      public List<TestEntity> initSomething() {


                      and

                      @Factory("houses") public void findHomes() {


                      is different.

                      Post the code for deploymentManager then...


                      If I understand the documentation of @Factory, the method can take on either definition. It doesn't make a difference. And the stack trace was for my "actual" code rather than the simplified example (my mistake.) It is the same error either way.

                      Here is the code with the "proper" method signature and stacktrace:

                      TestImpl.java:
                      import java.util.ArrayList;
                      import java.util.List;
                      
                      import javax.ejb.Stateless;
                      
                      import org.jboss.seam.ScopeType;
                      import org.jboss.seam.annotations.Factory;
                      import org.jboss.seam.annotations.In;
                      import org.jboss.seam.annotations.Logger;
                      import org.jboss.seam.annotations.Name;
                      import org.jboss.seam.annotations.datamodel.DataModel;
                      import org.jboss.seam.log.Log;
                      
                      import test.model.TestEntity;
                      
                      @Stateless
                      @Name("test")
                      public class TestImpl implements Test {
                       @Logger Log log;
                      
                       public void biteMe() {
                       log.info( testEntity.getName() );
                       something.add(testEntity);
                       }
                      
                       @In(scope=ScopeType.EVENT) private TestEntity testEntity;
                      
                       @DataModel(scope=ScopeType.PAGE) List<TestEntity> something;
                      
                       @Factory("something")
                       public void initSomething() {
                       something = new ArrayList<TestEntity>();
                       }
                      }
                      


                      Stacktrace...
                      javax.ejb.EJBTransactionRolledbackException: @In attribute requires non-null value: test.testEntity
                       at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
                       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                       at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                       at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:214)
                       at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:184)
                       at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:81)
                       at $Proxy117.initSomething(Unknown Source)
                       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.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                       at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                       at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
                       at org.javassist.tmp.java.lang.Object_$$_javassist_0.initSomething(Object_$$_javassist_0.java)
                       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:125)
                       at org.jboss.seam.Component.callComponentMethod(Component.java:2074)
                       at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1918)
                       at org.jboss.seam.Component.getInstance(Component.java:1855)
                       at org.jboss.seam.Component.getInstance(Component.java:1832)
                       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
                       at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
                       at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
                       at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
                       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
                       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                       at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
                       at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
                       at javax.faces.component.UIData.getValue(UIData.java:582)
                       at javax.faces.component.UIData.getDataModel(UIData.java:1063)
                       at javax.faces.component.UIData.setRowIndex(UIData.java:417)
                       at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:85)
                       at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
                       at javax.faces.component.UIData.encodeBegin(UIData.java:879)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:884)
                       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
                       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                       at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:282)
                       at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:262)
                       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:199)
                       at org.richfaces.renderkit.html.PanelRenderer.doEncodeChildren(PanelRenderer.java:194)
                       at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:121)
                       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
                       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
                       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
                       at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                       at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
                       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
                       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
                       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
                       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
                       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
                       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
                       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
                       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
                       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                       at java.lang.Thread.run(Thread.java:619)
                      Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: test.testEntity
                       at org.jboss.seam.Component.getValueToInject(Component.java:2160)
                       at org.jboss.seam.Component.injectAttributes(Component.java:1590)
                       at org.jboss.seam.Component.inject(Component.java:1408)
                       at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:45)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                       at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                       at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                       at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
                       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
                       at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
                       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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                       at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
                       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                       at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                       ... 108 more
                      


                      • 8. Re: @Factory method kills my @In fields
                        Paweł Stawicki Newbie

                        As far as I understand this, exception is thrown because testEntity is not initialized. I don't see any relation to @Factory here.

                        • 9. Re: @Factory method kills my @In fields
                          Tom N Newbie

                           

                          "amorfis" wrote:
                          As far as I understand this, exception is thrown because testEntity is not initialized. I don't see any relation to @Factory here.


                          @In is supposed to do the initialization! That's what dependency injection is.............. Right?

                          As I said, if @Factory is not there, the TestEntity bean is correctly initialized and injected. The exception is not thrown.

                          • 10. Re: @Factory method kills my @In fields
                            Christian Douven Newbie

                            Aren't @In methods injected before any other methods are called? Otherwise you couldn' use an @In injected SMPC in the @Factory-Method.

                            Did you try @IN(required=false, create= true)?

                            • 11. Re: @Factory method kills my @In fields
                              Tom N Newbie

                               

                              "christian.douven" wrote:
                              Did you try @IN(required=false, create= true)?


                              Actually, this seems to be it. I had to use "create=true" _and_ have the field name match the Seam name.

                              Thanks!