Environment is Jboss 5.1 and seam 2.2.0.GA and I get EntityManager inside initExportPayments() method with :
still can't get what the problem is,
Can anyone suggest me how can I get Seam Managed Entity Manager in Servlet (not resource).
em, true); returns null, when it works in every other place all over the application?
are you sure you have any seam components instanciated at all?
I've expirienced the same issue, with ear application, and I got it resolved when relocated seam framework jars properly - inside ear jboss-seam.jar must be in the root, others in lib folber(s).
initially I had them in lib folder(s)...
I have already instantiated seam components by the time I call that servlet.
I have ear application with several wars in it, I have seam framework jar in root of ear and seam-ui, seam-jul, etc in lib folders of my wars.
still have not solved the problem
thanks for response
i will try to relocate other seam jars to root as well and see what happens
Unfortunately I can't relocate seam-ui jar file in root folder as seam framework doesn't starts initialization on first URL invocation, but seam framework jar is in root and I have still this problem
Still can't get seam managed EntityManager in Servlet
no web ContextFilter and doWork methods solved my problem, the only way I have come up so far is:
EntityManagerFactory emf = (EntityManagerFactory)new InitialContext().lookup("java:/entityManagerFactory"); EntityManager em = emf.createEntityManager();