1 Reply Latest reply on Jan 6, 2009 5:50 PM by David Martin

    SEAM Booking Example - Should this work?

    David Martin Newbie
      Hello,

      After numerous searches and a post with no luck, I thought I would try replicating the problem that I am having using the SEAM booking example.

      Specifically, I am having issues trying to inject a stateful session bean into a parent stateful session bean - both SEAM components.  The only way that I can get it to work is to use both the @In and the @EJB...but I'm not sure if this correct based on the documentation.


      "Seam stateful session bean components may be instantiated using Component.getInstance()  or @In(create=true). They should not be directly instantiated via JNDI lookup or the new operator."

      With this in mind, I modified the HotelSearchAction class to inject the HotelBookingAction:

      @Stateful
      @Name("hotelSearch")
      @Scope(ScopeType.SESSION)
      // @LoggedIn
      public class HotelSearchingAction implements HotelSearching, Serializable
      {
             
         @In(create=true)
         private HotelBooking hotelBooking;
      ...
      ...
      }


      As you can see the interface is used for the injection and the variable name matches the @Name in the HotelBookingAction stateful session bean.

      I am using WebLogic 10.3 and SEAM 2.1.0.GA.  I have configured everything per the docs and it does work...of course until I insert the injection above.

      My question is should this work?  Is this a bug with SEAM...or should the docs state that for Weblogic the @In and @EJB need to be used in conjunction??

      This is the exception I get with the simple injection:

      javax.el.ELException: /main.xhtml @22,94 value="#{hotelSearch.searchString}": javax.ejb.EJBTransactionRolledbackException: EJB Exception: ; nested exception is: org.jboss.seam.InstantiationException: Could not instantiate Seam component: hotelBooking

      Thanks