Announcement Announcement Module
No announcement yet.
Injecting entitymanager in Glassfish Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.