Jun 10th, 2011, 03:43 AM
Injecting entitymanager in Glassfish
I want to use spring in a web application and deploy to glassfish. My application injects an entitymanager using the jpa annotation @PersistenceContext
In tomcat and jetty that works fine. In glassfish however, the web application fails to load because Glassfish tries to look up the entitymanager. The entitymanager is not set up in glassfish but in spring and therefore glassfish cannot find it and fails. The web application does not finish initialization successfully.
My question is: what is the best way to inject entitymanagers from spring without using the @PersistenceContext annotation so that it is possible to run the application in Glassfish.
Tags for this Thread