-
1. Re: Seam Managed EntityManager is null In Servlet
sashkanem May 27, 2010 9:42 AM (in response to sashkanem)Environment is Jboss 5.1 and seam 2.2.0.GA and I get EntityManager inside initExportPayments() method with :
(EntityManager)Component.getInstance("em", true);
still can't get what the problem is,
-
2. Re: Seam Managed EntityManager is null In Servlet
sashkanem May 31, 2010 3:12 AM (in response to sashkanem)Can anyone suggest me how can I get Seam Managed Entity Manager in Servlet (not resource).
Why (EntityManager)Component.getInstance(
em
, true); returns null, when it works in every other place all over the application? -
3. Re: Seam Managed EntityManager is null In Servlet
arifolth May 31, 2010 11:09 AM (in response to sashkanem)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)... -
4. Re: Seam Managed EntityManager is null In Servlet
sashkanem Jun 1, 2010 4:11 AM (in response to sashkanem)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
-
5. Re: Seam Managed EntityManager is null In Servlet
sashkanem Jun 1, 2010 4:12 AM (in response to sashkanem)i will try to relocate other seam jars to root as well and see what happens
-
6. Re: Seam Managed EntityManager is null In Servlet
sashkanem Jun 1, 2010 10:52 AM (in response to sashkanem)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
-
7. Re: Seam Managed EntityManager is null In Servlet
sashkanem Jun 2, 2010 11:05 AM (in response to sashkanem)Still can't get seam managed EntityManager in Servlet
-
8. Re: Seam Managed EntityManager is null In Servlet
sashkanem Jun 4, 2010 6:05 AM (in response to sashkanem)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();