4 Replies Latest reply on Jul 31, 2006 12:56 PM by Gavin King

    Problem injecting a stateful session bean

    Sean Burns Newbie

      Sorry, form pasted by accident???.... Anyway, as you can see as soon as I add that line to inject my bean I get that exception... everything works fine until I try inject my bean.

      Am I misssing something?

      Thanks Sean.

        • 1. Re: Problem injecting a stateful session bean
          Sean Burns Newbie

          :-/ having a bit of trouble with the forum. Here is the question.

          I have a normal bean that is populated with data.

          @Stateful()
          @Scope(ScopeType.SESSION)
          @Name("advancedSearch")
          public class AdvancedSearchBean implements AdvancedSearchLocal {


          I want to use this data so I try inject it with

          @Stateful()
          @Name("search")
          @Scope(ScopeType.CONVERSATION)
          public class SearchBean implements SearchLocal {
          
           private Integer pageSize=15;
          
           private int currentPage = 0;
          
           boolean hasMore = false;
          
           private String sender;
          
           @In(required=false)
           AdvancedSearchBean advancedSearch;


          but I get this exception as soon as I add that line

          11:50:22,966 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          javax.faces.FacesException: Error calling action method of component with id form:_id28
           at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
           at javax.faces.component.UICommand.broadcast(UICommand.java:106)
           at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
           at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
           at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
           at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
           at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
           at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
           at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
           at java.lang.Thread.run(Thread.java:595)
          Caused by: javax.faces.el.EvaluationException: /search.xhtml @23,68 action="#{search.doSearch}": javax.ejb.EJBException: java.lang.IllegalArgumentException:
           at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:73)
           at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
           ... 27 more
          Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: could not set field value: search.advancedSearch
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
           at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
           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:81)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
           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:188)
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
           at $Proxy100.doSearch(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:585)
           at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
           at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
           at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
           ... 28 more
          Caused by: java.lang.IllegalArgumentException: could not set field value: search.advancedSearch
           at org.jboss.seam.Component.setFieldValue(Component.java:1214)
           at org.jboss.seam.Component.injectFields(Component.java:1024)
           at org.jboss.seam.Component.inject(Component.java:795)
           at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
           at sun.reflect.GeneratedMethodAccessor119.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
           at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
           at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
           at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
           at sun.reflect.GeneratedMethodAccessor118.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
           at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
           at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
           at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
           at sun.reflect.GeneratedMethodAccessor117.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
           at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
           at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
           at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
           at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:13)
           at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
           at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
           at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
           at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
           at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:585)
           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:71)
           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.invokeInOurTx(TxPolicy.java:79)
           ... 51 more
          Caused by: java.lang.IllegalArgumentException
           at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
           at java.lang.reflect.Field.set(Field.java:656)
           at org.jboss.seam.Component.setFieldValue(Component.java:1210)
           ... 96 more


          • 2. Re: Problem injecting a stateful session bean
            Sean Burns Newbie

            I fixed it, was a silly error, I was not using the interface.

            • 3. Re: Problem injecting a stateful session bean
              Gavin King Master

              Current Seam CVS gives a much more helpful exception message for these kinds of problems.

              • 4. Re: Problem injecting a stateful session bean
                Gavin King Master

                But, of course, the easiest way to resolve the problem is to put a breakpoint in the line of Seam code that throws the exception.