Luciano,

What JPA package are you using? It should be responsible for handling the
injections ...

Jan
On 22 June 2011 15:18, Luciano Greiner <[email protected]> wrote:

> Hello.
>
>  I am coding a small webapp with the help of Maven and Jetty. I'm
> having a hard time trying to inject the EntityManagerFactory inside a
> Servlet (@Webservlet):
>
> @WebServlet("/test")
> public class TestServlet extends HttpServlet {
>
>        @PersistenceUnit(unitName="pu")
>        private EntityManagerFactory emf;
>
>        @Override
>        protected void doGet(HttpServletRequest request, HttpServletResponse
> response)
>                        throws ServletException, IOException {
>           emf... // is null
>
>        }
>
> It's always null. In the other hand
> Persistence.createEntityManagerFactory("pu") works.
>
> Am i doing anything wrong here?
>
> Thank you!
>
> Luciano G Santos
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to