users@glassfish.java.net

Re: glassfish-embedded-shell.jar 3.0.1 deployment issue

From: <glassfish_at_javadesktop.org>
Date: Mon, 21 Jun 2010 16:35:17 PDT

Also, seeing as this class is loaded by Spring and the method to load the GlassFish container is static, there should not be an issue with loading the container from this class.

@BeforeClass
public [b]static[/b] void setUpClass() throws Exception {
ejbContainer = EJBContainer.createEJBContainer();
}

Spring will load the Spring container, load this class and invoke the @BeforeClass method, which in turn instantiates the GlassFish embedded container. So this should have no bearing on the fact that the class is a @Stateless EJB.

But the real issue is where can I retrieve the EntityManager from? GlassFish is loading the persistence.xml file contained within the project and EclipseLink is even creating the tables, but that is only if I declare my dao classes as EJB's. Only then does the EntityManager get injected into these classes / EJBs. But I would like to leave these classes managed by Spring so Spring can oinject the EntityManager into them. However, I don't know where to lookup the EntityManager from. I've tried all the default, usual paths but the JNDI lookup fails. Is there a way to retrieve the EntityManager from JNDI?
[Message sent by forum member 'fericit_bostan']

http://forums.java.net/jive/thread.jspa?messageID=475283