0 Replies Latest reply on Nov 11, 2011 6:16 AM by David Visicchio

    PersistenceContext is null after datasource hot deploy

    David Visicchio Newbie


      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