Solve one question, end up finding another. ;)

I'm trying to get my EntityManager injected into my DAO layer, by specifying 
the core class of the DAO as an interceptor to my SLSB, which is acting as a 
SOAP service endpoint (enough buzzwords?).

I know by the deployment logs that the interceptor is being registered 
correctly. But no matter what, the EntityManager never gets injected, and 
remains null.

The persistence unit is configured in a separate persistence JAR from the EJB 
JAR, and everything is packed into an EAR. See below for the relevant 
annotations and snippets from everything:

@Stateless @WebService
@Interceptors({EJB3DAOFactory.class})
public class SOAPBackend
{
  ...
}

public class EJB3DAOFactory
{
    private static final Logger log = Logger.getLogger(EJB3DAOFactory.class);

    @PersistenceContext(unitName = "simunex")
    protected EntityManager em;

    public EJB3DAOFactory() {}

    protected EntityManager getEntityManager()
    {
        if (em == null) { log.debug("EntityManager is null!"); }
        return em;
    }
}

Like I said, the deployment logs correctly register the interceptor-based 
dependency on the EntityManager, and defers starting of the EJB until after 
Hibernate starts up. But whenever I attempt to perform a SOAP operation, which 
is serviced by SOAPBackend, the EntityManager remains null.

Options? I'd rather stay away from global JNDI lookup if possible. I know about 
the scoped deployment of the persistence unit. But I would've thought that a 
persistence unit defined in one JAR of an EAR would be within the scope of 
another JAR of the EAR.

Thanks!

--Scott


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3956035#3956035

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3956035

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to