I believe you have the same problem as I experienced: Guice JPA - "This connection has been closed." error
It's all nicely decribed in Issue 730: Automatically started UnitOfWork is never ended
When using the JpaPersistService, if you attempt to access an
EntityManager outside of an active UnitOfWork, Guice will
automatically start one for you. However, as Guice does not (and
cannot) know when to end this UnitOfWork, it never does.
Result? The offending thread will be stuck with the same EntityManager
throughout the life of the application. This is a bad state for the
application to run in, and ours inevitably exhaust the available
memory after a while and crash.
The real killer here is that it's not at all obvious when you've made
this mistake. The only real tip-off is that you're getting
inconsistent data from your database between different threads (due to
the EMs first-level cache) or that the applications memory consumption
keeps on growing.
In my case it was the active connection in the pool that got me to suspect it, and then, when I turned on detailed logging I noticed that app was not borrowing the connection from pool at all, instead it was reusing the connection already held by unclosed EntityManager.
Actually there are actually quite a few duplicates of this issue reported: http://code.google.com/p/google-guice/issues/list?can=1&q=UnitOfWork
So injecting the EntityManager wouldn't do much good I think. The problem occurs when you actually use any EntityManager methods. You just need to ensure every access is inside a UnitOfWork. How to do it depends on your application.