2 Replies Latest reply on Jan 25, 2008 1:05 PM by mocha

    stateless EJB not being injected

      I have a stateless DAO which needs to be injected into a session-scoped stateful bean.  The following classes result in a org.jboss.seam.RequiredException when calling a function on the stateful bean:


      @Stateless
      @Name("partyDAO")
      public class partyDAOBean Implements partyDAO
      



      @Stateful
      @Name("partySearch")
      @Scope(ScopeType.SESSION)
      public class partySearchBean implements partySearch
         @In(create=true)
         PartyDAO partyDAO
      



      this is the error


      Caused by: org.jboss.seam.RequiredException: @In attribute requires non-null value: partySearch.partyDAO
              at org.jboss.seam.Component.getValueToInject(Component.java:2168)
      



      injecting as an EJB works -e.g.


      @Stateful
      @Name("partySearch")
      @Scope(ScopeType.SESSION)
      public class partySearchBean implements partySearch
         @EJB
         PartyDAO partyDAO
      



      should the seam injection work in my example?

        • 1. Re: stateless EJB not being injected
          sebastiendeg.sebastien.degardin.gmail.com

          I tried the same chunk of code.


          If you set

          @In(create = true)

          it should work.


          • 2. Re: stateless EJB not being injected

            the original problem was a simple typo in the component name on the DAO. problem solved!


            Sebestien - it works for me with either

            @In(create = true)

            or
            @In(create=true)

            , but thanks for the suggestion.


            For anyone else trying to trace / debug component injection problems, you can turn on tracing by adding the following lines to your /jboss/server/default/conf/jboss-log4j.xml:


            <category name="org.jboss.seam.Component">
              <priority value="TRACE" />
            </category>
            



            this is what you should get in the jboss log when specifying create=true on injection:


            2008-01-25 10:31:31,561 TRACE [org.jboss.seam.Component] injecting dependencies of: partySearch
            2008-01-25 10:31:31,561 DEBUG [org.jboss.seam.Component] trying to inject with hierarchical context search: partyDAO
            2008-01-25 10:31:31,561 DEBUG [org.jboss.seam.Component] instantiating Seam component: partyDAO



            and this is what you get when Seam can't find the component by name


            2008-01-25 11:09:48,484 TRACE [org.jboss.seam.Component] injecting dependencies of: partySearch
            2008-01-25 11:09:48,484 DEBUG [org.jboss.seam.Component] trying to inject with hierarchical context search: partyDAO
            2008-01-25 11:09:48,484 DEBUG [org.jboss.seam.Component] seam component not found: partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.core.partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.transaction.partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.framework.partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.web.partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.faces.partyDAO
            2008-01-25 11:09:48,485 DEBUG [org.jboss.seam.Component] seam component not found: org.jboss.seam.international.partyDAO