[jboss-user] [EJB3] - PersistenceContext is null after datasource hot deploy

David Visicchio do-not-reply at jboss.com
Fri Nov 11 06:16:57 EST 2011

David Visicchio [http://community.jboss.org/people/ryandavid] created the discussion

"PersistenceContext is null after datasource hot deploy"

To view the discussion, visit: http://community.jboss.org/message/636103#636103

I am using some EJB3 session stateless bean with hibernate JPA integration on JBoss 5.1.0 GA. 

The EJBs are packaged within a JAR (containing the persistence.xml and *.hbm.xml mapping files) and each EJB defines a Session object injected with @PersistenceContext annotation. All works fine.

The problem raises when I try to make a hot deploy of the datasource. 

In this case I see that JBoss starts a new deployment of the datasource, of the persistence unit and the EJBs too but when I try to call an EJB I get a NullPointerException because the Session object wasn't injected.

This is the persistence.xml

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
             xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
          <persistence-unit name="CFP-HibernateManager" transaction-type="JTA">
                         <description>Configurazione di JPA</description>    
                  <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>

and the following is snipped code of an EJB

public class AnnoEJB extends CFPHibernateImpl implements AnnoRemote {

          private Session sx;

Any idea is appreciated.

Thanks a lot

Reply to this message by going to Community

Start a new discussion in EJB3 at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111111/0e62254c/attachment-0001.html 

More information about the jboss-user mailing list