0 Replies Latest reply on Jun 5, 2008 3:31 PM by pascal cousson

    Find an ejb statefull our session Bean in a servlet ?

    pascal cousson Newbie


      i have a probleme to retrieve seam component (session scope) in a servlet.

      We are working on :
      - sdk 6,
      - seam 2.0.0 GA
      - Jboss portal 2.6.
      - protletBridge 1.0.0.B2
      - richfaces.
      - Sherlocks e-payment solution of Atos()

      From a portlet, i can display a servlet view with one sessionID A. This view redirect to an outer view of the portal to do the payment.
      On this view, we redirect to a response servlet with an sessionID B.
      So, we redirect again on other servlet with the sessionID A.

      In this servlet, i try to find seam compoment (session bean or ejb statefull). But, this isn't working beceause i have not application context active.

      Context context = Contexts.getSessionContext();

      In this case, the session context is null.

      Component component = Seam.componentForName("testControler4Buy");
      if (component != null) {
      Object obj = component.getInstance("testControler4Buy", false);
      if (obj != null) {

      In this other case, an IllegalStateException is generated, becase, there is no Application Context Active.

      when i use JNDI, i have an instance of ejb 3, but it is a new instance, but I need the states of the ejb3 statefull or session bean.

      InitialContext ic = new InitialContext();
      Object object= ic.lookup("smalltox-ear/TestControler4Buy");
      TestControler4BuyLocalInterface test = (TestControler4BuyLocalInterface) object;

      Thanks for your help.