2 Replies Latest reply on May 31, 2006 11:35 AM by cavani

    Getting a Seam Component in a Servlet

    gian.corzo

      Hi

      I'm trying to get a Seam component in a Servlet, this servlet start with the application (load on start up).

      I use this to get the Component:

      
      .....
      
      Hashtable env = new Hashtable();
       env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.LocalOnlyContextFactory");
       env.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
       ctx = new InitialContext(env);
      
      bean = (Procesador)ctx.lookup("ProcesadorBean/local");
      
      ....
      
      


      Because I wanted to inject a Spring Bean in it and start a process.

      My problem is that when I get the Seam component this way the seam doesn't inject the persistent Manager.

      @Name("parseador")
      @Stateful
      public class ProcesadorBean implements Procesador {
      
      ....
      
       @In(create = true)
       private EntityManager fonocontrolDatabase;
      
      .....
      
      }
      
      Is there any other way to do the same?